Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Rename multiple podcast files (cpm)

30 views
Skip to first unread message

Carlos M

unread,
Oct 8, 2012, 8:21:23 PM10/8/12
to
In a directory with several podcast files, I am looking to rename them with a concat of the feed name and title:

$ cat 1349346290243.meta
#
#Thu Oct 04 03:25:06 PDT 2012
duration=90201
title=Some Multitasking Is More Taxing
mimetype=audio/mp3
feedName=60 second psych
url=http\://www.pheedo.com/e/fdf1f9845a3c8c5dc08cf5cbf4de0587/sa_p_podcast_120728.mp3
size=0

to create a file named:

60_second_psych-Some_Multitasking_Is_More_Taxing.meta

Appreciate any help!

Janis Papanagnou

unread,
Oct 9, 2012, 6:46:33 AM10/9/12
to
I'd do that with the help of a shell, something like

awk -F= '
/^title=/ {t=$2;gsub(/ /,"_",t)}
/^feedName=/ {f=$2;gsub(/ /,"_",f);
printf "mv -i \"%s\" \"%s-%s.meta\"\n", FILENAME, f, t}
' *.meta | sh

But you can also trigger awk's system() command (so that you don't see
the shell outside of the awk code).

Janis

Carlos M

unread,
Oct 10, 2012, 9:53:37 PM10/10/12
to
Awesome! Thank you!!
0 new messages