7/23/2013

Using awk and sort in Linux

 Contents of script file port.awk:
BEGIN{ }
{
   if (NR > 2) print $1
}

The awk script tells system to process an ASCII file to dump the first field of the input record, as long as the current input record number in the input file is greater than 2 (i.e., printing the 1st field starting from the 3rd line of the input file).

awk -f port.awk PORT_M1 | sort > port_m1.sort

沒有留言:

張貼留言