bash problem ???

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Thomas Cameron
Date:  
Subject: bash problem ???
----- Original Message -----
From: "Nathan England" <>
To: "Phoenix Linux Users Group" <>
Sent: Friday, September 05, 2003 5:32 PM
Subject: bash problem ???


> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
>
> I have a string like this:
>
> nathan/has/no/brains
>
> My problem is, I need to but that string up so only "brains" is available.
> Problem is, the string is different everytime. Sometimes it may be 2 words
> seperated by / or it may be 15 words seperated by /
>
> The only similarity between every string, is I only want the LAST word

from
> each string.
>
> How do I do that?
>
>
> nathan/is/brain/dead            I want dead
> my/computer/is/not/helping      I want helping
> this/sucks                              I want sucks

>
> get it?
> How can I accomplish this with bash? I know there is a way to count how
> many fields there are using / as a delimiter, but I can't remember how
> to do it!!!
>
> help?
>



awk -F \/ '{ print $NF }'
--
Thomas Cameron, RHCE, CNE, MCSE, MCT
Cameron Technical Services, Inc.
http://www.camerontech.com/
(512) 454-3200