You are not logged in.

Is it possible with bash, to create a script that will scan a text file and remove words that are set in a list?
I have a file with words like so:
word1
word2
word3
I would like to be able to set script to scan file and remove only the words (and spaces left) that are in a list,
that is inside script. Is this possible???
Last edited by orphius1970 (2010-04-22 12:05:45)
AMD Phenomx3, 4gb ram, Nvidia Gforce 9400gt,
MSI K9N2 Diamond Motherboard, Arch x86_64
Offline

concatentate all the words in the list then use sed with "or" expressions (|), e.g
$ sed s/"hal\|netmask"// /etc/rc.confOffline

sorry I am new to scripting and Have NEVER used sed.
Can you explain a little better?
Ok i tried it and understand a little better. However,
It left space behind. How do I fix that?
Also, how do I get it to save the file with the changes?
Sorry If I seem so noobie
Last edited by orphius1970 (2010-04-22 11:27:18)
AMD Phenomx3, 4gb ram, Nvidia Gforce 9400gt,
MSI K9N2 Diamond Motherboard, Arch x86_64
Offline

grep -vf words.list /path/to/file > /path/to/cleaned-fileAre you familiar with our Forum Rules, and How To Ask Questions The Smart Way?
BlueHackers // fscanary // resticctl
Offline

thank you fukawi2 !
I can work with that
AMD Phenomx3, 4gb ram, Nvidia Gforce 9400gt,
MSI K9N2 Diamond Motherboard, Arch x86_64
Offline