[CentOS] question on grep

William L. Maltby CentOS4Bill at triad.rr.com
Thu Oct 11 23:28:52 UTC 2007

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:
> > > <snip>

> Well he never stated a non-standard field separator, but if that is the case, with awk:
> echo "jerry,jerry-jerry jerry" | awk 'BEGIN{RS="[^[:alnum:]]"} /^jerry$/ {jerry++} END{print jerry}'
> That'll separate records by any non-alphanumeric.
> (I had messed up the comparison on my first post)

I just wanted to say thanks to Ross for reminding folks on the list
about the existence of the venerable (g)awk.

I think a lot of folks would be pleasantly surprised about its power and
simplicity of use, if one is already regex familiar.

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.

> -Ross
> <snip sig stuff>


More information about the CentOS mailing list