Email address obfuscation in effect -- please
click here to turn it off.
[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
- To: MLUG Members <EMAIL:PROTECTED>
- Subject: Re: [MLUG] perl, awk, sed, etc.
- From: Stephen Montgomery-Smith <EMAIL:PROTECTED>
- Date: Tue, 04 Dec 2007 19:54:50 -0600
- Delivery-date: Tue, 04 Dec 2007 19:55:42 -0600
- Envelope-to: EMAIL:PROTECTED
- In-reply-to: <EMAIL:PROTECTED>
- References: <EMAIL:PROTECTED> <EMAIL:PROTECTED> <EMAIL:PROTECTED> <EMAIL:PROTECTED> <EMAIL:PROTECTED> <EMAIL:PROTECTED> <EMAIL:PROTECTED> <EMAIL:PROTECTED> <EMAIL:PROTECTED> <EMAIL:PROTECTED> <EMAIL:PROTECTED> <EMAIL:PROTECTED>
- Reply-to: MLUG Members <EMAIL:PROTECTED>
- Sender: EMAIL:PROTECTED
- User-agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.8.1.9) Gecko/20071118 SeaMonkey/1.1.6
Mike Miller wrote:
On Tue, 4 Dec 2007, Michael wrote:
I very frequently call perl from the bash script to do various little
things, almost always regexp search/replace because that is what I know.
Nothing wrong with that. Perl for short things and especially good for
regexp stuff. Of course awk and sed can sometimes be good for small
things too. :)
On SOLARIS, awk and sed can both be limited or buggy. The GNU versions
are clearly superior. Example: awk can only count fields (NF) up to
something like 256, which is not enough! sed also fails without warning
with long lines -- this bug is rather famous because it causes some
installation scripts to fail on SOLARIS.
All I really know how to do with sed is search/replace, I just do it in
perl instead. I feel much more confident that it will work and the code
will be portable to any system that has perl running.
I do use gawk a lot (but not awk, though I believe these are identical
on a GNU/Linux system). Mostly stuff like this:
gawk -F'\t' '$4>3 {print $2" "$5}' file.in > file.out
Mike
_______________________________________________
members mailing list
EMAIL:PROTECTED
http://mlug.missouri.edu/mailman/listinfo/members
One problem I found with sed is that they have different options on BSD
and Linux. So "sed -r" on Linux is "sed -E" on BSD.
_______________________________________________
members mailing list
EMAIL:PROTECTED
http://mlug.missouri.edu/mailman/listinfo/members