[Cialug] lsof! grep?

Jeffrey Ollie jeff at ocjtech.us
Tue Jul 1 10:33:52 CDT 2008


On Tue, Jul 1, 2008 at 10:30 AM, Todd Walton <tdwalton at gmail.com> wrote:
> On Mon, Jun 30, 2008 at 6:20 PM, Jeffrey Ollie <jeff at ocjtech.us> wrote:
>> On Sun, Jun 29, 2008 at 9:03 AM, Todd Walton <tdwalton at gmail.com> wrote:
>>> lsof | awk '{print $9}' | grep \\.so | sort -u
>>
>> Grep uses regular expressions to match lines.  A period in a regular
>> expression means "match any character".  A backslash in front of the
>> period tells grep to not give the period any special meaning and to
>> match just a period. The second backslash in front of the other
>> backslash escapes the backslash for the shell.
>
> Oh.  So could I accomplish the same thing with:
>     grep ".so"

No, because that would match "Aso", "Bso", etc:

$ echo "Aso" | grep ".so"
Aso

Jeff


More information about the Cialug mailing list