[Gllug] Extracting part of string in bash script

Ian Norton bredroll at darkspace.org.uk
Wed Apr 13 10:58:19 UTC 2005


On Sat, Apr 09, 2005 at 07:29:05AM +0100, Dylan wrote:
> Hi All,
> 
> I'm putting together a script to rename ogg files according to the 
> file's tags. Using ogginfo and grep, I can isolate the relevant tags 
> like:
> 
> ARTIST=Queen
> 
> How can I extract the artist name and discard the rest of the line?


echo ARTIST=Queen | cut -d = -f 2-

that will extract anything after an = sign,

to get the right tag you can put the cut part on the end of a grep, ie,

echo ARTIST=Queen |grep ^ARTIST=| cut -d = -f 2-

shoud print out :

Queen

Ian 



-- 
Ian Norton-Badrul

-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list