View Single Post

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

Can you please help me determine where there are unmatched quotes (")
in my .mailfilterrc file?

grep -c returns the number of lines where the " appears, but I need
something that counts the number of instances of " per line.

Something like

while read LINE; do
count how many times " occurs in this line
if count=0 then ignore # Skip zero and
if count<>2 then echo $LINE # two; show all others
done <.mailfilterrc

TIA, I'm crosseyed looking at 377 lines :<
buck
Reply With Quote