willisoften Posted May 17, 2005 Report Share Posted May 17, 2005 (edited) Is there a way to find an ' in a regular expression apart from [[:punct:]] I want to check a number of files for correct use of s' and 's \' doesn't work but [[:punct:]] does but I can't make the ? operator work when using it. Any thoughts out there? egrep -o '[A-Za-z]*s[[:punct:]]|[A-Za-z]*[[:punct:]]s' filename is currently working for me but it seems incredibly clumsy. Edited May 17, 2005 by willisoften Quote Link to comment Share on other sites More sharing options...
theYinYeti Posted May 17, 2005 Report Share Posted May 17, 2005 ' should work. If it does not, it probably is because of bad quoting. Remember that in bash, nothing can be quoted inside single quotes, not even single quotes themselves. You should try that (note the external double quotes instead of single quotes): egrep -o "[A-Za-z]*s'|[A-Za-z]*'s" filename Yves. Quote Link to comment Share on other sites More sharing options...
willisoften Posted May 17, 2005 Author Report Share Posted May 17, 2005 Thanks, for that I would never have though to use " rather than ' force of habit I suppose. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.