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:
<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.
Well thank you, but we shouldn't forget about sed either, it is even smaller and can be just as powerful too (check out some of the advanced sed scripts floating around the net).
I like perl for the advanced scripting applications it can create, but like python and other rich scripting languages sometimes it is just a little thick for what needs to be done.
With such an extensive tool box there is always just the right tool for the job.
-Ross
______________________________________________________________________ This e-mail, and any attachments thereto, is intended only for use by the addressee(s) named herein and may contain legally privileged and/or confidential information. If you are not the intended recipient of this e-mail, you are hereby notified that any dissemination, distribution or copying of this e-mail, and any attachments thereto, is strictly prohibited. If you have received this e-mail in error, please immediately notify the sender and permanently delete the original and any copy or printout thereof.