Wednesday 12 October 2011

Perl Execution from Command Line

Here the test is the file has contents delimited by '|' PIPE , you can split them and do process w.r.t fields


Ex:
perl -e 'while(<>) {@fields=split(/\|/,$_);print "$fields[10]\n";$ctype{$fields[14]}+=$fields[10];} foreach $c (keys %ctype){print "$c:$ctype{$c}\n"}' < test