[plug] Manipulating a text file

Steve Vertigan vertigan at bigfoot.com
Mon Feb 5 19:43:02 WST 2001


"Earnshaw, Mike" wrote:

> I am having trouble extracting the first columns of our passwd file into
> another file ...
> 
> mike:x:500:500 ....
> 
> I have about 100 users and I just want the names column. I have played
> around a bit with cut and awk but the correct syntax is eluding me. I
> think I may need to get the 'nutshell' book ...

I haven't got round to learning cut or awk but this is one way to do it
with perl.
# perl -F: -ane 'print "$F[0]\n";' /etc/passwd

Regards,
Steve

-- 
FreeBSD maestro.dhis.org 3.4-STABLE i386
 7:45PM  up 21 days, 47 mins, 2 users, load averages: 0.13, 0.06, 0.07
Just about every computer on the market today runs Unix, except the Mac
(and nobody cares about it).
		-- Bill Joy 6/21/85



More information about the plug mailing list