Re: format grep ouput

2007-07-16 Thread BartlebyScrivener
On Jul 16, 5:00 pm, William Pursell <[EMAIL PROTECTED]> wrote: > The following works with filenames with spaces. It > displays the filename after the text match, though. > > find . -type f -name "*$1" -exec sh -c "grep --color -i $2 '{}' && \ > echo ' echo {}' && echo" \; > That wor

Re: format grep ouput

2007-07-16 Thread William Pursell
andy baxter wrote: grep -R 'the' * | (of=""; while read f l ; do if [ "$f" != "$of" ] ; then echo ; fi; echo $f $l ; of=$f; done) will put a linebreak after every new filename, as long the none of the filenames have spaces in. This puzzled me for a while: [EMAIL PROTECTED]:~/tmp$ cat inp

Re: format grep ouput

2007-07-16 Thread andy baxter
BartlebyScrivener wrote: On Jul 15, 2:30 pm, Ron Johnson <[EMAIL PROTECTED]> wrote: Try this. It's untested but should nudge you in the right direction. Almost, it prints each word on a separate line, but I'll pursue the idea. Thank you, rd grep -R 'the' * | (of=""; while read f

Re: format grep ouput

2007-07-16 Thread William Pursell
BartlebyScrivener wrote: On Jul 15, 4:20 pm, Jeff D <[EMAIL PROTECTED]> wrote: probably the easiest thing to do is write up a little wrapper for grep like so: #!/bin/sh if [ -z $1 ] ; then echo "please enter file type" exit 1 fi if [ -z $2 ] ; then echo "ple

Re: format grep ouput

2007-07-16 Thread Bob McGowan
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 hi

Re: Re: format grep ouput

2007-07-16 Thread Jon Dowland
> Where does that command go? In bashrc? > > So far, I just have the ls alias and this: > > export GREP_OPTIONS='--color=auto' It's an argument to grep. So you could manually it in with every grep, alias grep to "grep --color=always" in the style of ls in ~/.bashrc, or define the GREP_OPTIONS en

Re: format grep ouput

2007-07-16 Thread BartlebyScrivener
On Jul 16, 6:20 am, Jon Dowland <[EMAIL PROTECTED]> wrote: > You can specify --color=always to Where does that command go? In bashrc? So far, I just have the ls alias and this: export GREP_OPTIONS='--color=auto' Thanks, rd -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "u

Re: Re: format grep ouput

2007-07-16 Thread Jon Dowland
> Any piping will eliminate the color. That's what happens, > at least, with ls. The default for --color is to only do it with an interactive terminal. You can specify --color=always to ensure it is output even as part of a pipe. You can make things like less pass the control characters through to

Re: format grep ouput

2007-07-16 Thread BartlebyScrivener
On Jul 15, 4:20 pm, Jeff D <[EMAIL PROTECTED]> wrote: > probably the easiest thing to do is write up a little wrapper for grep > like so: > #!/bin/sh > if [ -z $1 ] ; then > echo "please enter file type" > exit 1 > fi > > if [ -z $2 ] ; then > echo "please enter

Re: format grep ouput

2007-07-15 Thread Ron Johnson
On 07/15/07 15:14, BartlebyScrivener wrote: On Jul 15, 3:00 pm, William Pursell <[EMAIL PROTECTED]> wrote: You might consider the -C (or -B or -A) options to grep. Yes, I've played with these, too. The problem in large text files with wrapped paragraphs, each "line" can be quite long, so even

Re: format grep ouput

2007-07-15 Thread Jeff D
On Sun, 15 Jul 2007, BartlebyScrivener wrote: On Jul 15, 3:00 pm, William Pursell <[EMAIL PROTECTED]> wrote: You might consider the -C (or -B or -A) options to grep. Yes, I've played with these, too. The problem in large text files with wrapped paragraphs, each "line" can be quite long, so e

Re: format grep ouput

2007-07-15 Thread Thomas Jollans
On Sun, 2007-07-15 at 14:29 -0500, Ron Johnson wrote: > On 07/15/07 13:40, 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

Re: format grep ouput

2007-07-15 Thread BartlebyScrivener
On Jul 15, 3:00 pm, William Pursell <[EMAIL PROTECTED]> wrote: > You might consider the -C (or -B or -A) options to grep. Yes, I've played with these, too. The problem in large text files with wrapped paragraphs, each "line" can be quite long, so even -C1 gives a big block before and after. But

Re: format grep ouput

2007-07-15 Thread BartlebyScrivener
On Jul 15, 2:30 pm, Ron Johnson <[EMAIL PROTECTED]> wrote: > Try this. It's untested but should nudge you in the right direction. Almost, it prints each word on a separate line, but I'll pursue the idea. Thank you, rd -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubsc

Re: format grep ouput

2007-07-15 Thread William Pursell
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 hi

Re: format grep ouput

2007-07-15 Thread Ron Johnson
On 07/15/07 13:40, 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