Skip to content

Instantly share code, notes, and snippets.

@sathishshan
Created December 31, 2020 09:53
Show Gist options
  • Save sathishshan/2abfb6f8f2666331c00488d8b7a85285 to your computer and use it in GitHub Desktop.
Save sathishshan/2abfb6f8f2666331c00488d8b7a85285 to your computer and use it in GitHub Desktop.
grep -Porn <pattern>
P: Use Perl engine, grep can't run modern regexes otherwise
o: Only show the matching part, not the whole line
r: Search recursively
n: Print line number of matches
Bonus: use -Porh to exclude filenames from output i.e. only show matches. Great for piping.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment