[Gllug] Parsing strings in a shell script

Stuart Sears stuart at sjsears.com
Thu Sep 9 20:31:46 UTC 2004


On Thursday 09 September 2004 21:18, Dylan wrote:
> Hi All,
>
> I'm trying to get a script together to batch process a bunch of ogg
> files. As part of it, I need to extract the tag information. ogginfo
> provides output like:
>
> dylan at scooby(1):/media/server/music/test> ogginfo "David Bowie - Blue
> Jean.ogg"
> Processing file "David Bowie - Blue Jean.ogg"...
>
> New logical stream (#1, serial: 60e4a0f7): type vorbis
> Vorbis headers parsed for stream 1, information follows...
> Version: 0
> Vendor: Xiph.Org libVorbis I 20030909 (1.0.1)
> Channels: 2
> Rate: 44100
>
> Nominal bitrate: 64.001000 kb/s
> Upper bitrate not set
> Lower bitrate not set
> User comments section follows...
>         ALBUM=Best of Bowie
>         ARTIST=David Bowie
>         DATE=2002
>         DESCRIPTION=
>         GENRE=
>         KDE-ENCODER=kio_audiocd
>         TITLE=Blue Jean
>         TRACKNUMBER=30
> Vorbis stream 1:
>         Total data length: 1550426 bytes
>         Playback length: 3m:11s
>         Average bitrate: 64.668446 kbps
> Logical stream 1 ended
> dylan at scooby(1):/media/server/music/test>
>
> which I can grep lines from:
>
> dylan at scooby(1):/media/server/music/test> ogginfo "David Bowie - Blue
> Jean.ogg" | grep ARTIST
>         ARTIST=David Bowie
> dylan at scooby(1):/media/server/music/test>
>
> but I can't work out how to strip everything except the artist name
> (leaving just David Bowie) I figured I could use:
>
> dylan at scooby(1):/media/server/music/test> ogginfo "David Bowie - Blue
> Jean.ogg" | grep ARTIST | sed 's/        ARTIST=//'
>         ARTIST=David Bowie
> dylan at scooby(1):/media/server/music/test>
try ogginfo "David Bowie - BlueJean.ogg" | grep ARTIST | cut -d= -f2
and see what that gives you...

Stuart
--
Stuart Sears RHCE, RHCX
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list