[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: format grep ouput



BartlebyScrivener wrote:
I'm playing with recursive grep. Still fairly new to Etch.

When I grep text files and get a dozen or so results, they print to
the screen as a dense block of text.  I found the color option, which
helps, but is there a way to separate each result with a blank line,
or highlight the file name or something?

I know some Python if I have to pipe it to a Python script.  But I'm
thinking there's some easy pipe I could using just bash and Linux
commands, as this must be a common probelm.

You might consider the -C (or -B or -A) options to grep.  This
gives context, so
$ grep -C 2 foo file
will show 2 lines before and 2 lines after the line
containing foo, and results will be separated by "--"



Reply to: