View Single Post

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

On Tue, 25 Jan 2005 09:26:40 GMT, Robert Komar <robk@robpc2.home.org>
wrote:

>buck <buck@private.mil> wrote:
>>
>>
>> Can you please help me determine where there are unmatched quotes (")
>> in my .mailfilterrc file?
>> TIA, I'm crosseyed looking at 377 lines :<
>> buck

>
>Hi,
>maybe the thing to do is to look for lines with a single " first
>using regular expressions with grep, and if that doesn't uncover
>your problem, then look for 3 or more.
>
>Maybe something like the following:
>
>grep -e '^[^\"]*\"[^\"]*$' filename
>grep -e '^[^\"]*\"[^\"]*\"[^\"]*\"' filename
>
>Cheers,
>Rob Komar


Rob,

Thank you. These say I have no unmatched quotes. The first returns
nothing and the second returns lines where there are 4 " characters.

Please "teach me to fish". Say in words what one or the other of the
above lines does.

What does that first ^[

mean?

Doesn't the ^\"

right after that mean to find a line that _begins_ with a quote?

What is the purpose of the first ]

Perhaps a better question is "where do I find documentation for
(extended?) regular expressions so I can understand these two lines?"

Color me perplexed but greatful. Thx again
buck
Reply With Quote