RE: question on grep

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



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>

--
Bill

_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos

[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux