printing hh in hh:mm using "awk '{FS=":";print $1}'" misses first line of output!!
input -->
% cat file 11:30 12:20 13:10 unexpected output :( --> % awk '{FS=":";print $1}' file 11:30 12 13 expected output :) --> % awk '??' file 11 12 13 Please suggest what's wrong with the command. Thanks in advance. Also consider, % awk '{ if(NR>1) {FS=":";print $1} }' file 12:20 13 It is as if awk has decided not to work on 1st row of input supplied !! |
Hi, welcome to LQ!
2 options. Put Code:
awk -F: '{....' |
Hi,
awk -F: '{ print $1 }' infile or awk 'BEGIN { FS=":" } { print $1 }' infile Hope this helps. |
All times are GMT -5. The time now is 12:08 PM. |