RE: how to delete a word from a file using shell scripting???
Be careful what you mean by the word "word"
A couple of people have answered with the "sed" command which is good but if you're looking for actually removing a "word" and not a part of a word the instruction needs some modification.
For example to remove the word "the"
echo "Other than the aesthetics there's the synthetics" | sed 's/the//g'
Produces:
Or than aestics re's syntics
To remove the word "the" and not pieces of other words add triangle brackets around the text. These must be quote from the shell e.g.:
sed 's/<the>//g'
So the new result with the brackets will look like this:
Other than aesthetics there's synthetics
The text embedded within other text is not affected.
Of course the next thing to do is pipe your file into this "sed" command and pipe the output into a different file. Inspect the result and if you're satisfied replace the original file with the new one.
RE: how to delete a word from a file using shell scripting???
please note that my original answer ate the quote signs which I'm going to try to make sure get through this time:
sed 's/\<the\>//g'
And in case that gets eaten also it's a reverse slash then the less than (<) the text to be replaced ("the") the the reverse slash then the greater than (>)