I would like to wget a list of items that I'm retrieving from an XML file. I'm using sed to clean up the XML, and I'm ending up with output like this:
CountofMonteCristo.zip
English.
http://www.archive.org/download/count_monte_cristo_0711_librivox/count_monte_cristo_0711_librivox_64kb_mp3.zip
Alexandre.
Dumas.
LettersofTwoBrides.zip
English.
http://www.archive.org/download/letters_brides_0709_librivox/letters_brides_0709_librivox_64kb_mp3.zip
Honoréde.
Balzac.
BleakHouse.zip
English.
http://www.archive.org/download/bleak_house_cl_librivox/bleak_house_cl_librivox_64kb_mp3.zip
Charles.
Dickens.
I'd like to use wget -i to download these files as Language.Lastname.Firstname.Title.zip
I'm open to re-arranging the file somehow so that I can use $filename $url
I've tried a few different sed commands. Sed is what I've used to clean up the XML tags, but I can't figure out how to move text to the appropriate place. The titles, names, and languages will vary for each file.
EDIT: Before cleaning up the tags with sed, each line is wrapped in tags, such as English and FileTitle. I think this could be helpful in identifying patterns to re-arrange things.
EDIT2: Here's the XML source
EDIT3: Something like this looks like it would work, but I'm having trouble modifying it to suit my needs.
My ultimate goal is to organize all of the files into folders, with a hierarchy of Language -> AuthorLastnameFirstname -> Files.zip
If what I'm doing is not best practice, I'm open to other methods.
Thanks
xpath
. – DopeGhoti Apr 2 '18 at 18:12