[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ale] Riddle me this awk man
I think the NR==1 is to print a set of headers at the top of the file.
Just a guess.
David
On Thu, Feb 17, 2011 at 9:03 PM, Geoffrey Myers
<lists at serioustechnology.com> wrote:
> Geoffrey Myers wrote:
>
>> I still wonder whether it's something to do with the actual number of
>> fields. ?If the lines that you think have a single field end or begin
>> with a space, awk will think there is a null field.
>
> Okay, the above assumption is wrong, but the below I think is your
> issue. ?NR == 1 only for the first record.
>
>>
>> Wait a minute. ?Should you be using NF not NR? ?NF == number of fields
>> NR == number of records.
>
>
> --
> Until later, Geoffrey
>
> "I predict future happiness for America if they can prevent
> the government from wasting the labors of the people under
> the pretense of taking care of them."
> - Thomas Jefferson
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://mail.ale.org/mailman/listinfo/ale
> See JOBS, ANNOUNCE and SCHOOLS lists at
> http://mail.ale.org/mailman/listinfo
>
--
David Tomaschik, RHCE, LPIC-1
System Administrator/Open Source Advocate
OpenPGP: 0x5DEA789B
http://systemoverlord.com
david at systemoverlord.com