When I use grep -o to search in multiple files, it outputs each result prefixed with the file name. How can I prevent this prefix? I want the results without the file names.

  • 2
    From man grep -h, --no-filename Suppress the prefixing of filenames on output when multiple files are searched. – rahul May 20 '15 at 14:29

Use option -h.

-h, --no-filename
          Suppress the prefixing of file names on  output.   This  is  the
          default  when there is only one file (or only standard input) to
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.