Re: [Hampshire] Any grep gurus here?

Page principale

Répondre à ce message
Auteur: Victor Churchill
Date:  
À: Hampshire LUG Discussion List
Sujet: Re: [Hampshire] Any grep gurus here?
1. I too thought you might need to backslash the paren but i does
indeed complain.
2. You also need to tell grep to not report cases where the paren *is* closed.
3. If you use single quote (which I think tells the shell to not
examine the contents for interpolation):


victor@pan2:/tmp$ grep -e '^.*([^)]*$' brackets
foo(bar unclosd

victor@pan2:/tmp$ cat brackets
foo(bar)
foo(bar unclosd
foo(bar)closed

victor@pan2:/tmp $

This does assume that the closing paren needs to be on the same line.
If that's not the case then you are into trickier territory.