Answers for "bash grep only match"

0

grep without match

Just filter your output with:
grep -v "excluded_pattern"
Example to get all not txt files in current directory.
ls | grep -v .txt
Posted by: Guest on October-22-2020
0

grep extract only matched string

grep -E -o "insert regex here"
Posted by: Guest on July-07-2020
-1

grep or match

$ grep "PATTERN1|PATTERN2" FILE
$ grep -E "PATTERN1|PATTERN2" FILE
$ grep -e PATTERN1 -e PATTERN2 FILE
$ egrep "PATTERN1|PATTERN2" FILE
Posted by: Guest on April-12-2021

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language