Search code examples
shellgrepag

ag grep tool - How to print only the log lines without file name/path in the output?


I am trying to grep the folder that has lot of files using following ag command, and print results with out file name/path.

 ag --print-long-lines "test|temp" | grep -Ei  "error|fail"

But i still see the file names(sampledata1.txt, sampledata2.txt) in the following output

sampledata1.txt test:error 
sampledata2.txt temp:fail

Solution

  • ag --nofilename "test|temp"