Hello,
I am testing some data to get line number at cursor position 9 and found some problem, the code is below.Assume we got 3 attribute. At second attribute, there are some data(eg.A41/A6) missing like at the fourth and six line
11006 A41 1888
11006 A6 2456
11006 A43 4532
11006 3333
11006 A33 5412
11006 8987
11006 A34 4999
if there is no data missing at second attribute, when i use the code
Code:
awk '{ printf("%-7s%-22s%-17s%-4s\n",$1,FNR,$2,$3,$4); }' myfile
it is working perfect and printing all line number at cursor postion 9.
But if there is missing data at second or third attribute,line number print ok ,but the output data mess up like that
11006 1 A41 1888
11006 2 A6 2456
11006 3 A43 4532
11006 4 3333
11006 5 A33 5412
11006 6 8987
11006 7 A34 4999
Any idea how to fix this problem?
Many thanks