View Single Post

   
  #8 (permalink)  
Old 02-19-2008, 09:20 PM
Robert Komar
 
Posts: n/a
Default Re: OT How to count occurances in a text file

Loki Harfagr <lars.hummigeret@yahuu.no> wrote:
>
>
> Le Tue, 25 Jan 2005 16:11:07 +0100, Loki Harfagr a ?crit?:
>
>> Le Mon, 24 Jan 2005 23:24:45 -0800, buck a ?crit?:
>>
>>> Can you please help me determine where there are unmatched quotes (")
>>> in my .mailfilterrc file?
>>> if count=0 then ignore # Skip zero and
>>> if count<>2 then echo $LINE # two; show all others
>>> done <.mailfilterrc

>>
>> Now, another, funny but simpler one :

>
> and better :
> # awk '{if(NF){if ((NF+1)%2){print NR "\t" NF-1 "\t" $0} }; }' FS=\" file


Using the " as a field separator for awk is a good idea. I wish I thought
of it.

Cheers,
Rob Komar
Reply With Quote