Re: [Hampshire] Any grep gurus here?

Top Page

Reply to this message
Author: Victor Churchill
Date:  
To: Hampshire LUG Discussion List
Subject: 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.