[Cialug] lsof! grep?

Jeff Chapin chapinjeff at gmail.com
Tue Jul 1 10:58:53 CDT 2008


The boundary token is different in different  flavours of regex. I 
tested the \> and \< with my version of grep and had to use \b...

Oh and I was under the impression that " will work with variable 
expansion, but keep the '\' as is...

Jeff

Nathan Stien wrote:
> 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\>'
> _______________________________________________
> Cialug mailing list
> Cialug at cialug.org
> http://cialug.org/mailman/listinfo/cialug
>   



More information about the Cialug mailing list