Skip to content

Commit 8616c46

Browse files
Grep options: e,v,r,o
Signed-off-by: Arnob kumar saha <[email protected]>
1 parent a7270d9 commit 8616c46

File tree

5 files changed

+45
-1
lines changed

5 files changed

+45
-1
lines changed

.idea/.gitignore

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/bashscripting.iml

+9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

common/grep.bash

+14-1
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,17 @@ grep "your-search" some-folder/* # to use grep in a whole directory. Here * is
2525
-c # for count. It shows the filename & how many times your serach result matched in that file
2626

2727
-P # for perl-compatible-regular-expression
28-
grep -P "\d{3}-\d{2}" file.txt # searches 3 digits + a dash + 2 digits in file.txt
28+
grep -P "\d{3}-\d{2}" file.txt # searches 3 digits + a dash + 2 digits in file.txt
29+
30+
tar --help | grep -w '\--directory' # exact match (including special character)
31+
tar --help | grep -w '\-x\|\-z\|\-f' # same as above , but with OR
32+
33+
-e -E <regex>
34+
-v <your-search> # Simulate the NOT operation
35+
-r # Recursive search in a folder
36+
37+
export GREP_OPTIONS='--color=auto' GREP_COLOR='100;8' # To modify the grep output options
38+
39+
grep -o "hi.*bye" filename # If you want to show only the matched part, not the full line
40+
41+

0 commit comments

Comments
 (0)