awk command : To print the output to a file

half of the problem is already solved with the help of bartus11 suggestion

I have a txt file having rows and coulmns, i want to perform some operation on a specific coulmn starting from a specific line.

50.000000               1           1           1
  1000.00000    
  1000.00000    
   50000.000    
     19
     19
  3.69797533E-07   871.66394       36.611320      -12.000000      -35.290180          4      5
  1.13238150E-06   879.03741       36.047676      -10.800000       38.395638          4      4
  6.69133044E-07   717.85254       34.777313      -9.1999998       24.722189          3      3
  8.59679221E-06   381.38339       33.485676      -8.0000000       14.840780          1      1
  5.23395693E-06   247.83061       33.334003      -5.5999999      -5.1661811          0      1
  6.89546050E-06   259.99509       33.329212      -5.1999998      -6.1069846          0      1

I want to select the data from 3rd coulmn from 7th line to end of clm. And find out the minimum and the maximum out of them.then calculate the difference between the min and max .

delay = max-min 

and write "min" "max" "delay" to a txt file for further operation

awk 'NR==7{min=$3;max=$3}NR>7{if ($3>max){max=$3};if ($3<min){min=$3}}END{print "min: "min" max: "max}' file

I tried few options but it dosent work

awk 'NR==7{min=$3;max=$3} NR>7{if ($3>max){max=$3};if ($3<min){min=$3}}END delay=max-min {print "To: "min"  Tmax : "max"   delay= "delay }' seamount1.arr 

Umm a sintax error , try:

awk 'NR==7{min=$3;max=$3} NR>7{if ($3>max){max=$3};if ($3<min){min=$3}}END{delay=max-min; print "To: "min"  Tmax : "max"   delay= "delay }'

still i'm getting an 'awk' syntax error

r u on solaris? use then nawk..

problem solved with the help of " bartus11 "

awk 'NR==7{min=$3;max=$3} NR>7{if ($3>max){max=$3};if ($3<min){min=$3}}END{delay=max-min;print "To: "min"  Tmax : "max" delay= "delay }' seamount1.arr

now everything works absolutely fine.

Exactly the same i provided u ...