I want to remove some text from file1.txt
.
I put the text in the file tmp
and do:
grep -f tmp file.txt
But it gives me only the difference.
The question is how to remove the difference from file.txt
.
awkgreplinuxsed
I want to remove some text from file1.txt
.
I put the text in the file tmp
and do:
grep -f tmp file.txt
But it gives me only the difference.
The question is how to remove the difference from file.txt
.
Best Answer
Doing
grep -f tmp file.txt
will display all lines containing the worktext
(assumetmp
just contins the worktext
). If want to display all the lines that don't contain the word text you need to use the-v
option to invert the match:If you print all the lines in the file but just remove all occurrences of
text
then: