Global Regular Expression Print

From 6bit.ch wiki
Revision as of 16:28, 30 December 2022 by Xbl (talk | contribs) (→‎Useful Flags)
Jump to navigation Jump to search

grep

Print lines from text that match patterns, basic regex is used by default

Use

grep /etc/ssh/sshd_config pattern match pattern in /etc/sshd_config, case sensitive

Useful Flags

-E use extended regex
-i case insensitive
-A x print x lines after matched pattern
-B x print x lines before matched pattern
-C x print x lines before and after matched pattern, results separated by "--"
-n print line number from file
-o only print matched pattern
-R search all files in given folder