I'm quite new to awk and I'm having a problem i don't understand. Using the following I always seem to get the first like of my file printing out (which i don't want).
[tim]$ gawk '/Pre/{Pre=$0;i=0;next} NF{if(!i)print;++i;next}' test/30-b18-a.txt
invalid command name "nu" <-- first line of input file that i don't want
221.136
344.918
362.138
390.118
I think i've narrowed this down to that fact that NF is grabbing the first line in the file and outputting that and then moving on to do the search that i want and outputting my values. Is this correct? If so how do i fix it?
If it matters here's a short sampling of the input file:
[tim]$ more b20/30-b20-a.txt
invalid command name "nu"
You are now editing in 'ft'. 1 ft = 304.8 mm
ae 0 -30
Auto-tolerance is 5.000000e-03
Presented area from this viewpoint, square ft:
221.136
ae 45 -30
Auto-tolerance is 6.000000e-02
Presented area from this viewpoint, square ft:
344.918
I'd appreciate any help you guys could offer. So far I've found this place very helpful in learning, it always amazes me how many nice people there are out there that share their knowledge with other.
Thanks in advance
tim
[tim]$ gawk '/Pre/{Pre=$0;i=0;next} NF{if(!i)print;++i;next}' test/30-b18-a.txt
invalid command name "nu" <-- first line of input file that i don't want
221.136
344.918
362.138
390.118
I think i've narrowed this down to that fact that NF is grabbing the first line in the file and outputting that and then moving on to do the search that i want and outputting my values. Is this correct? If so how do i fix it?
If it matters here's a short sampling of the input file:
[tim]$ more b20/30-b20-a.txt
invalid command name "nu"
You are now editing in 'ft'. 1 ft = 304.8 mm
ae 0 -30
Auto-tolerance is 5.000000e-03
Presented area from this viewpoint, square ft:
221.136
ae 45 -30
Auto-tolerance is 6.000000e-02
Presented area from this viewpoint, square ft:
344.918
I'd appreciate any help you guys could offer. So far I've found this place very helpful in learning, it always amazes me how many nice people there are out there that share their knowledge with other.
Thanks in advance
tim