| Stepan Kasal 2004-09-09, 3:56 pm |
| Hi,
In article <chn3q6$5v7$1@sunnews.cern.ch>, Laurent Deniau wrote:
> warning: (near initialization for `ooc_cls#####_.alloc')
....
> I tried
> /"warning: (near initialization for `ooc_cls"[A-Za-z0-9_]+"_.alloc')"$/
> but I get an error at the ')'
The regex to match the above line could be
/warning: \(near initialization for `ooc_cls[A-Za-z0-9_]+_\.alloc'\)$/
The parens and the dot are meta-chars and you have to escape them.
When you put this into shell script between single quotes, you have to
know that backslash is not special inside them. So you can leqave all
backslashes as they are, but to insert the single quote, you have to use
'''
or
'"'"'
Basically, you have to get out of single quotes and then specify the single
quote using a backslash or double quotes.
So:
#!/bin/sh
make 2>&1 | awk '\
/warning: \(near initialization for `ooc_cls[A-Za-z0-9_]+_\.alloc'''\)$/
{ print $0; }'
>
should work.
HTH,
Stepan
|