[Cialug] lsof! grep?
Nathan Stien
nathanism at gmail.com
Tue Jul 1 10:58:34 CDT 2008
On Tue, Jul 1, 2008 at 10:45 AM, Jeff Chapin <chapinjeff at gmail.com> wrote:
> I tend to single quote and avoid the multiple '\' issue all together. The
> single quotes eliminate the escaping need for bash.
I was surprised to find that not everyone does this. Sometimes you
can't use single quotes because you need to do $VARIABLE substitution,
but not usually in a regex.
> To add a fun little regex trick, to match '.so' at the end of a word, and
> not midword (foo.soblah) or end of a line (.so$ from earlier) grep supports
> word boundry tokens (/b) so you can do the following:
I have a similar habit, but I use \< and \> to get beginning and
ending word boundaries. Picked that up from hitting * in vim, which
takes the word under the cursor and sets the current search regex to
be '\<foo\>'.
$ grep '\.so\>'
More information about the Cialug
mailing list