[Gllug] Extracting part of string in bash script

Dylan dylan at dylan.me.uk
Sat Apr 9 08:01:00 UTC 2005


On Saturday 09 Apr 2005 08:39 am, Richard Cohen wrote:
> On Apr 9, 2005 7:29 AM, Dylan <dylan at dylan.me.uk> wrote:
<SNIP>
> > How can I extract the artist name and discard the rest of the line?
>
> Considering what bash is and isn't, it has some vaguely decent
> text-processing built in.  In this case, the following might help:
>
> richardc$ foo="ARTIST=Queen"
> richardc$ echo $foo
> ARTIST=Queen
> richardc$ echo ${foo#ARTIST=}
> Queen
> richardc$ echo ${foo#*=}
> Queen

Nice - now to find it in the docs :)

Dylan

>
> > Cheers
> > Dylan
>
> Cheers
> Richard

-- 
"I see your Schwartz is as big as mine" 
                                  -Dark Helmet
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list