User Tools

Site Tools


sed:print:print_1_line_of_context_before_and_after_regexp_with_line_number_indicating_where_the_regexp_occurred

SED - Print - Print 1 line of context before and after regexp, with line number indicating where the regexp occurred

Similar to “grep -A1 -B1”.

sed -n -e '/regexp/{=;x;1!p;g;$!N;p;D;}' -e h
sed/print/print_1_line_of_context_before_and_after_regexp_with_line_number_indicating_where_the_regexp_occurred.txt · Last modified: 2020/08/16 13:44 by 192.168.1.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki