Skip to content

Instantly share code, notes, and snippets.

@todgru
Last active January 11, 2023 16:49
Show Gist options
  • Select an option

  • Save todgru/4423368 to your computer and use it in GitHub Desktop.

Select an option

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