bash:files:display_every_line_in_a_file_matching_the_regular_expression
BASH - Files - Display every line in a file matching the regular expression
Display the lines matching the regular expression. (emulates grep).
awk '/regex_here/' filename
Display the lines that don't match the regular expression. (emulates grep -v).
awk '!/regex_here/' filename
Display the line before the regular expression match.
awk '/regex_here/{print x};{x=$0}' filename
Display the line after the regular expression match.
awk '/regex_here/{getline; print}' filename
bash/files/display_every_line_in_a_file_matching_the_regular_expression.txt · Last modified: 2022/06/13 11:09 by peter