Bash and grep: Difference between revisions

From I Will Fear No Evil
Jump to navigation Jump to search
(Created page with "=== Common grep switches === Show line number of match <pre> grep -n <string> <file(s)> </pre> Insensitive match <pre> grep -i <string> <file(s)> </pre> Before and after # lines from match <pre> grep -A# -B# <string> <file(s)> </pre> Category:Bash")
 
mNo edit summary
Line 1: Line 1:
<metadesc>Basic grep examples.</metadesc>
=== Common grep switches ===
=== Common grep switches ===
Show line number of match
Show line number of match

Revision as of 14:57, 25 April 2024

Common grep switches

Show line number of match

grep -n <string> <file(s)>

Insensitive match

grep -i <string> <file(s)>

Before and after # lines from match

grep -A# -B# <string> <file(s)>