Skip to content

Instantly share code, notes, and snippets.

@todgru
Last active January 11, 2023 16:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save todgru/4423368 to your computer and use it in GitHub Desktop.
Save todgru/4423368 to your computer and use it in GitHub Desktop.
grep find string between line numbers, before after

grep

-A lines after find -B lines before find -n number the lines of the file and display that number before each result(s)

$ grep -A20 -B20 -n 'this is what im looking for' filnameToSearch.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment