User Tools

Site Tools


linux:grep

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
linux:grep [2022/11/23 12:49] – external edit 127.0.0.1linux:grep [2024/07/27 19:48] (current) bstafford
Line 5: Line 5:
 ===== Seach Directory ===== ===== Seach Directory =====
 <code>grep -rl "string" /path</code> <code>grep -rl "string" /path</code>
 +
 +===== Invert =====
 +Find anything NOT matching
 +<code>grep -v stuffIdonotWant</code>
 +
 +===== Match IP Address =====
 +
 +Match IPv4 address
 +<code>grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b"</code>
 +<code>grep -oE "(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))" </code>
linux/grep.1669207782.txt.gz · Last modified: by 127.0.0.1