Grep: Difference between revisions

Content added Content deleted
Line 45: Line 45:
|-
|-
| Display N lines around match || grep -C 2 "Example" demo_text
| Display N lines around match || grep -C 2 "Example" demo_text
|-
| Color Filtered Output || grep "Gecko" /data --color=always
|-
|-
| Highlighting the search using GREP_OPTIONS || export GREP_OPTIONS='--color=auto' GREP_COLOR='100;8'
| Highlighting the search using GREP_OPTIONS || export GREP_OPTIONS='--color=auto' GREP_COLOR='100;8'
Line 77: Line 79:
|-
|-
| Search Email addresses using regex || <nowiki>grep -E -o "\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,6}\b" filename.txt</nowiki>
| Search Email addresses using regex || <nowiki>grep -E -o "\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,6}\b" filename.txt</nowiki>
|-
| Grep from compressed files || zgrep -I "free space" ./messages*
|}
|}
<br />
<br />