Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It's definitely better than shell for quick file processing :) Check out this fantastic cut replacement (thanks to mjd):

  #!/usr/bin/perl
  
  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;
  }


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: