Recent Changes

Updates since 1970-01-01 00:00 UTC

(for 2021-08-23_grep_and_context_lines only)

1 | 3 | 7 | 30 | 90 days
List latest change per page only List only major changes
List later changes RSS RSS with pages RSS with pages and diff

2021-08-23

  • 04:22 UTC (new) 2021-08-23 grep and context lines . . . . mbork Sometimes (well, actually pretty often!) I need to search text files with grep. By default, it displays all the lines that are matched by some regular expression. As is usual with heavily-used and battle-tested shell commands, it has numerous well-though arguments, like -H and -h (print or suppress the filename prefix in every line), -n (print the line number along with the matching line) and many others. A few weeks ago, however, I had an extremely specific need, and I was very pleasantly surprised that grep supported precisely my use-case. I wanted to grep a log file having a particularly annoying format, and I wanted grep to display every match together with one preceding and two following lines. Well, it turns out that grep has such a feature, too.

More...

Filters