-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgrep.sh
More file actions
33 lines (23 loc) · 662 Bytes
/
grep.sh
File metadata and controls
33 lines (23 loc) · 662 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/env bash
for grep command this is tutorial
grep <string> <filename>
here both file and string can take regular expression
like
grep *string *filename
options are
-A <N> no of line after lines
-B before match
-C around match
-i case insensitive
-v other than match
-w consider words
-c count of match
-vc count of non match lines
-r recurrsive match find inside the lines
like
grep -r "string" *
-l show filename where string got matched as output
-o only show matched string as output
-b show position of matched string
-n no of line output you want to see
grep -iRB -10 "string" . //it will give you before 10 line with match search