in reply to Re^2: printing passwd file
in thread printing passwd file

And arbitrarily playing golf:
perl -lne 'print "@{[(split /:/)[0, 4]]}"' /etc/passwd
Or particularly well suited to -a and -F:
perl -F: -lane 'print "@F[0, 4]"' /etc/passwd

--
[ e d @ h a l l e y . c c ]

Replies are listed 'Best First'.
Re^4: printing passwd file
by ambrus (Abbot) on Mar 14, 2005 at 18:28 UTC

    Well, if you want to play golf, you can even leave out the spaces:

    perl -F: -lane 'print "@F[0, 4]"' /etc/passwd
    or leave out perl completely:
    cut -d: -f1,5 /etc/passwd|tr : \
    of which the end reminds me to this classic error message:
    $ \(- -bash: (-: command not found