Global Regular Expression Print
Revision as of 16:27, 30 December 2022 by Xbl (talk | contribs) (Created page with "= grep = Print lines from text that match patterns, basic regex is used by default</br> == Use == <code>grep /etc/ssh/sshd_config pattern</code> match pattern in /etc/sshd_config, case sensitive</br> == Useful Flags == <code>-E</code> use extended regex</br> <code>-i</code> case insensitive</br> <code>-A x</code> print x lines after matched pattern</br> <code>-B x</code> print x lines before matched pattern</br> <code>-C x</code> print x lines before and after matched...")
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