How to extract string from filename solved

Tony Baechler tony at
Thu Jul 30 11:52:21 UTC 2015

Hi all,

Thanks very much to all of you.  I modified the script posted by Willam and it now does what I want.  Yes, scripting is educational.  I found out about rev which I didn't know about before.  Here is the final script.  It seems to do what I want and I'm very greatful.  Thanks to all of you for your excellent suggestions!  I saved most of them.

#Since there are no spaces in the names, use for loop 
for i in $(ls *mp3);do 
grab=`echo $i|rev|cut -f2 -d'_'|rev` 
 wget -q$grab  -O"`basename $i .mp3`.html"

More information about the Blinux-list mailing list