grep tips

grep tips

The following will create a new file with lines removed containing given pattern:

cat file.txt | grep -v "pattern" >filtered.txt

Match two words:
grep -E -i -w 'word1|word2' sourcefile.txt
grep -rl "string" /path // -r recurse, -l output filenames only


Leave a Reply