RE: [CentOS] question on grep

2007-10-11 Thread Ross S. W. Walker
William L. Maltby wrote: > > On Wed, 2007-10-10 at 16:10 -0400, Ross S. W. Walker wrote: > > Stephen Harris wrote: > > > > > > On Wed, Oct 10, 2007 at 04:32:30PM -0300, mups.cp wrote: > > > > > > > Well he never stated a non-standard field separator, but if > that is the case, with awk: > > >

Re: [CentOS] question on grep

2007-10-11 Thread Andy Harrison
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 10/11/07, William L. Maltby wrote: > Personally, in many years of use, I feel I still do not need to learn > Perl (although I did get a book and dabble with it some) for 99.9% of > things that *I* do. > > Awk does the job for me. > If it's any

RE: [CentOS] question on grep

2007-10-11 Thread William L. Maltby
On Wed, 2007-10-10 at 16:10 -0400, Ross S. W. Walker wrote: > Stephen Harris wrote: > > > > On Wed, Oct 10, 2007 at 04:32:30PM -0300, mups.cp wrote: > > > > Well he never stated a non-standard field separator, but if that is the case, > with awk: > > echo "jerry,jerry-jerry jerry" | awk 'BEGIN

Re: [CentOS] question on grep

2007-10-10 Thread James Olin Oden
On 10/10/07, Ross S. W. Walker <[EMAIL PROTECTED]> wrote: > True! > > Regular expressions sure are fun :-) > > I think we've shown enough variations here to give the OP the > idea that there are a lot of ways to skin this cat. But we have to think him for the mental stimulation. Its nice to see t

RE: [CentOS] question on grep

2007-10-10 Thread Ross S. W. Walker
Stephen Harris wrote: > > On Wed, Oct 10, 2007 at 04:10:05PM -0400, Ross S. W. Walker wrote: > > Stephen Harris wrote: > > > > > > On Wed, Oct 10, 2007 at 04:32:30PM -0300, mups.cp wrote: > > > > A simple one > > > > # echo "jerry jerry" | tr " " "\n" | grep -c jerry > > > > 2 > > > > > > But wh

RE: [CentOS] question on grep

2007-10-10 Thread Ross S. W. Walker
James Olin Oden wrote: > > On 10/10/07, Ross S. W. Walker <[EMAIL PROTECTED]> wrote: > > mups.cp wrote: > > > > > > A simple one > > > # echo "jerry jerry" | tr " " "\n" | grep -c jerry > > > 2 > > > > > > The perl seems more general. > > > > > > To add yet another variation: > > > > echo "jerry j

Re: [CentOS] question on grep

2007-10-10 Thread Stephen Harris
On Wed, Oct 10, 2007 at 04:10:05PM -0400, Ross S. W. Walker wrote: > Stephen Harris wrote: > > > > On Wed, Oct 10, 2007 at 04:32:30PM -0300, mups.cp wrote: > > > A simple one > > > # echo "jerry jerry" | tr " " "\n" | grep -c jerry > > > 2 > > > > But what about jerry.jerry or jerry/jerry or jerr

RE: [CentOS] question on grep

2007-10-10 Thread Ross S. W. Walker
Ross S. W. Walker wrote: > > mups.cp wrote: > > > > A simple one > > # echo "jerry jerry" | tr " " "\n" | grep -c jerry > > 2 > > > > The perl seems more general. > > > To add yet another variation: > > echo "jerry jerry" | awk 'BEGIN {RS=FS} {/jerry/ jerry++} END > {print jerry}' That shou

Re: [CentOS] question on grep

2007-10-10 Thread James Olin Oden
On 10/10/07, Ross S. W. Walker <[EMAIL PROTECTED]> wrote: > mups.cp wrote: > > > > A simple one > > # echo "jerry jerry" | tr " " "\n" | grep -c jerry > > 2 > > > > The perl seems more general. > > > To add yet another variation: > > echo "jerry jerry" | awk 'BEGIN {RS=FS} {/jerry/ jerry++} END {pr

RE: [CentOS] question on grep

2007-10-10 Thread Ross S. W. Walker
Stephen Harris wrote: > > On Wed, Oct 10, 2007 at 04:32:30PM -0300, mups.cp wrote: > > A simple one > > # echo "jerry jerry" | tr " " "\n" | grep -c jerry > > 2 > > But what about jerry.jerry or jerry/jerry or jerry,jerry or Well he never stated a non-standard field separator, but if that is

RE: [CentOS] question on grep

2007-10-10 Thread Ross S. W. Walker
mups.cp wrote: > > A simple one > # echo "jerry jerry" | tr " " "\n" | grep -c jerry > 2 > > The perl seems more general. To add yet another variation: echo "jerry jerry" | awk 'BEGIN {RS=FS} {/jerry/ jerry++} END {print jerry}' -Ross > On 10/10/07, Andy Harrison <[EMAIL PROTECTED]> wrote: >

Re: [CentOS] question on grep

2007-10-10 Thread Stephen Harris
On Wed, Oct 10, 2007 at 04:32:30PM -0300, mups.cp wrote: > A simple one > # echo "jerry jerry" | tr " " "\n" | grep -c jerry > 2 But what about jerry.jerry or jerry/jerry or jerry,jerry or (and please don't top post!) -- rgds Stephen ___ CentOS m

Re: [CentOS] question on grep

2007-10-10 Thread mups . cp
A simple one # echo "jerry jerry" | tr " " "\n" | grep -c jerry 2 The perl seems more general. On 10/10/07, Andy Harrison <[EMAIL PROTECTED]> wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > > > On 10/10/07, Jerry Geis wrote: > > Is there a command line option on grep that says > > c

Re: [CentOS] question on grep

2007-10-10 Thread Andy Harrison
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 10/10/07, Jerry Geis wrote: > Is there a command line option on grep that says > count ALL occurances on a line not just the first one??? > > echo "jerry jerry" | grep -c jerry > Grep can just count the number of lines with occurrences not the n

[CentOS] question on grep

2007-10-10 Thread Jerry Geis
Is there a command line option on grep that says count ALL occurances on a line not just the first one??? echo "jerry jerry" | grep -c jerry only returns 1 and not 2. Looking at the man page I did not see anything like that. Thanks, Jerry ___ CentOS