[Gllug] Parsing strings in a shell script

Dylan dylan at dylan.me.uk
Thu Sep 9 20:18:01 UTC 2004


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>

but no!

Suffice it to say I have tried various permutations of pipes and 
redirects, but I either get the output above, or bash admonishes me for 
ambiguous redirection.

Any pointers would be greatfully received.

Cheers

Dylan
-- 
"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