Re: more stupid shell tricks

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Mike Garfias
Date:  
To: plug-discuss
Subject: Re: more stupid shell tricks
Your shell is intrepreting $. Make it literal by wrapping it in single
quotes.
grep -v '$'

Craig White spoke forth with the blessed manuscript:
> On Wed, 2005-02-02 at 11:32 -0700, Joseph Toon wrote:
> > On Wednesday 02 February 2005 11:22 am, Craig White wrote:
> > > How would I delete the lines that have a '$' in them denoting a machine
> > > account?
> >
> > Use the grep invert match switch:
> >
> > getent passwd | awk -F: '$3 > 499 { print $1 }' | grep -v $ > users
> >
> ---
> seems logical (and too simple...I was trying infinitely more complex awk
> stuff)...
>
> [root@mail scripts]# getent passwd | awk -F: '$3 > 499 && $3 < 10000 \
> { print $1 }'|grep -v $ > /root/scripts/users
> [root@mail scripts]# cat users
> [root@mail scripts]#
>
> ends up with empty file - methinks grep doesn't like searching for $ but
> no difference with "$" either...
>
> Craig
>
> ---------------------------------------------------
> PLUG-discuss mailing list -
> To subscribe, unsubscribe, or to change you mail settings:
> http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss

---------------------------------------------------
PLUG-discuss mailing list -
To subscribe, unsubscribe, or to change you mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss