On Mon, Apr 22, 2002 at 12:16:15PM -0400, Brian Chabot <[EMAIL PROTECTED]> wrote:
> On Mon, 22 Apr 2002 [EMAIL PROTECTED] wrote:
> 
> > I said:
> >
> > > in other words, given: "1234M /home/USER" I want "USER" so as to then turn
> > > around and email that user. (I already have
> > > way of removing non-user directories in /home).
> 
> Woo hoo!
> 
> Thanks for all the lightning fast help.
> 
> I already had most of the script written, but now I think I'll go back
> and re-write much of it thanks to all your input!

    Yuck, yuck, yuck!  It looks like everyone was pointing out ways to
use sed to accomplish this.  Now, sed may give you extra power, but when
writing shell scripts, I prefer to avoid using external commands where
possible.  To that extent, consider:

$ foo="1234M /home/USER"
$ echo ${foo##*/}
USER
$

    Look at the bash man page for '#', '##', '%', and '%%'.

-- 
Bob Bell                Compaq Computer Corporation
Software Engineer       110 Spit Brook Rd - ZKO3-3/U14
TruCluster Group        Nashua, NH 03062-2698
[EMAIL PROTECTED]     603-884-0595

*****************************************************************
To unsubscribe from this list, send mail to [EMAIL PROTECTED]
with the text 'unsubscribe gnhlug' in the message body.
*****************************************************************

Reply via email to