I'm using:
grep -n -H -o -R -e textword .
List all file recursively under directory '.' with string 'textword' and show the file, line and only portion matching.
I need to remove lines that matched the text using a Linux command.
find . -type f -exec sed -r -i "/textword/d" {} +
Remember that the search text is interpreted as a regexp by sed
(with the -r
option), so it might need escaping.
Use sed -i.backup
to backup original files as <filename>.backup
.
With GNU find
and sed
you could:
find . -type f -print0 | xargs -0 sed -i '/^FIND$/d'
sed
?