#!/usr/local/bin/perl # # Extract selected columns from file # $colNum = 3; while (<>) { $thisLine = $_; foreach $colNum (@ARGV) { $thisLine =~ /(\S+\s+){$colNum}/; printf "%7s", $1; } print "\n"; }