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

[SLUG] Re: Script needed



On Thu, Jun 01, 2000 at 03:26:22PM +1000, Adam Kennedy wrote:
> > perl -F: -anle 'print $F[0]' </etc/passwd
> >
> > > perl -e 'print grep { s/^(\w+)\:.*$/$1/; 1; } <>' < inputfile >
> outputfile
> > >
> 
> True, but that is a way of applying any arbitrary regex...
> Comes in very handy for doing lots of other things too.
> 
> More complicated, but more powerfull.

whereas in awk, the field delimiter (-F option) is already a regex

awk: simpler but more powerful  (?)


(down side being: everyone here who uses (eg) "awk -F: '{print $2}'"
to get password fields will screw up on those records that have no
password "user::somethingelse")

-- 
 - Gus
--
SLUG - Sydney Linux Users Group Mailing List - http://www.slug.org.au
To unsubscribe send email to slug-request@nospam.slug.org.au with
unsubscribe in the text