#!/usr/bin/perl #: print the Nth field of each line my $field = shift or usage(); $field -= 1 if $field > 0; while (<>) { chomp; my @f = split; print $f[$field], "\n"; } sub usage { print STDERR "$0 fieldnumber\n"; exit 1; } __END__ I love this utility! It's by Mark-Jason Dominus. Note that you can do any of: f 3 < some_file f 3 some_file f 3 some_file another_file ... stuff | f 3 Note that 1 means the first field. (Fields are 1-indexed.) Here's more of his brilliant stuff: http://perl.plover.com/classes/mybin/samples/MENU.html http://blog.plover.com/prog/runN.html Read them! -- sburke@cpan.org ~End~