I want to do a grep in bash on a folder searching for the term foobar. I then want to output all of the matches along w/ the filename and line number where the occurrences were found. Is this possible?
I need the output to look like:
{{filename}}:{{line_number}} - {{matched_text}}
-His the option that adds filenames,-nadds line numbers,-ris recursiveI get filenames even without the
-Hunless there’s only one file.Add
-ifor case-insensitiveAdd
-Efor extended regular expressions