xargs and grep

Associate
Joined
1 Aug 2003
Posts
1,053
I wanted to grep -v a text file, but the file was too long, so I did the standard thing of piping to xargs grep, but the text file contains a list of file names and when piped to xargs, it tries to read the files rather than treating the output as text and running grep on the text - any suggestions?

My first thought was to use sed to insert something at the beginning of each line but was wondering if there was a simpler method.
 
Turns out, there was no problem with running grep just from bash - the only thing in the text file that didn't match the string was the line 'too many arguments'..... it took me hours to figure that out, felt like such an idiot
 
Back
Top Bottom