How do I search for apostrophe using egrep?
der Mouse
mouse at thunder.mcrcim.mcgill.edu
Mon Jul 1 10:58:40 AEST 1991
In article <1991Jun25.074801.517 at weyrich.UUCP>, orville at weyrich.UUCP (Orville R. Weyrich) writes:
> I have been trying to make egrep search for words which are enclosed
> in apostrophes, for example 'hello'.
> I can't seem to get this to work.
egrep \''[^'\'']*'\'
or perhaps less confusingly,
egrep "'[^']*'"
where I am assuming you want to require that the word itself not
contain any 's.
Your problem is unlikely to be with egrep; more likely it's shell
quoting conventions tripping you up. Decide what regex you want to
pass to egrep, then play with echo until you get the quoting right so
that your regex gets through intact. If egrep doesn't like it *then*,
you may have problems.
der Mouse
old: mcgill-vision!mouse
new: mouse at larry.mcrcim.mcgill.edu
More information about the Comp.unix.questions
mailing list