I have this list of download links.
https://download6.onlinetvrecorder.com/download/2540675/flatrate/18289288/114326c538e72a0cf23b9bc82aae1a36/de/Babylon_5_20.03.31_19-10_tele5_65_TVOON_DE.mpg.HQ.avi/267994/29709747
https://download6.onlinetvrecorder.com/download/2540675/flatrate/18287021/60f414e4589608f806873c4c3df79b87/de/Babylon_5_20.03.30_19-10_tele5_65_TVOON_DE.mpg.HQ.avi/512242/29699567
https://download6.onlinetvrecorder.com/download/2540675/flatrate/18280561/f1b399cf3283b19d7bdcac959dea37e6/de/Babylon_5_20.03.27_19-10_tele5_65_TVOON_DE.mpg.HQ.avi/791489/29671092
https://download6.onlinetvrecorder.com/download/2540675/flatrate/18258229/e4d94ac7ea38a8f0551a93d2c3703219/de/Babylon_5_20.03.26_19-10_tele5_65_TVOON_DE.mpg.HQ.avi/787046/29660809
https://download6.onlinetvrecorder.com/download/2540675/flatrate/18256176/835ce99116e11ee417fb12d41e44867d/de/Babylon_5_20.03.25_19-10_tele5_65_TVOON_DE.mpg.HQ.avi/261645/29650516
https://download6.onlinetvrecorder.com/download/2540675/flatrate/18254120/e4a69bcc66a0491c949f5f43736f3fb9/de/Babylon_5_20.03.24_19-10_tele5_65_TVOON_DE.mpg.HQ.avi/428464/29640134
https://download6.onlinetvrecorder.com/download/2540675/flatrate/18251876/82863dcdb412cd44c49b9956959b8685/de/Babylon_5_20.03.23_19-10_tele5_65_TVOON_DE.mpg.HQ.avi/479411/29629751
It turns out the download daemon used the last entry as file name.
-rwxrwxrwx 1 gottsch gottsch 593984618 Mar 23 14:56 29629751
-rwxrwxrwx 1 gottsch gottsch 632598628 Mar 24 14:57 29640134
-rwxrwxrwx 1 gottsch gottsch 535594310 Mar 25 14:55 29650516
-rwxrwxrwx 1 gottsch gottsch 537082534 Mar 26 14:55 29660809
-rwxrwxrwx 1 gottsch gottsch 529020006 Mar 27 14:55 29671092
-rwxrwxrwx 1 gottsch gottsch 560333670 Mar 30 15:05 29699567
-rwxrwxrwx 1 gottsch gottsch 534740104 Mar 31 14:56 29709747
I now want to rename the files to something more meaningful.
Using awk :
awk 'BEGIN {FS="/"} {print "mv ",$12,$10}' wunschliste.txt.fertig
I am expecting something like :
mv 29709747 Babylon_5_20.03.31_19-10_tele5_65_TVOON_DE.mpg.HQ.avi
However (unexpectedly) I get:
$ awk 'BEGIN {FS="/"} {print "mv ",$12,$10}' wunschliste.txt.fertig
Babylon_5_20.03.31_19-10_tele5_65_TVOON_DE.mpg.HQ.avi
Babylon_5_20.03.30_19-10_tele5_65_TVOON_DE.mpg.HQ.avi
Babylon_5_20.03.27_19-10_tele5_65_TVOON_DE.mpg.HQ.avi
Babylon_5_20.03.26_19-10_tele5_65_TVOON_DE.mpg.HQ.avi
Babylon_5_20.03.25_19-10_tele5_65_TVOON_DE.mpg.HQ.avi
Babylon_5_20.03.24_19-10_tele5_65_TVOON_DE.mpg.HQ.avi
Babylon_5_20.03.23_19-10_tele5_65_TVOON_DE.mpg.HQ.avi
Well, where is my 'mv' ? Where is the first argument?
Edit. there was an ask for this cmd:
head -1 wunschliste.txt.fertig | od -c
0000000 h t t p s : / / d o w n l o a d
0000020 8 . o n l i n e t v r e c o r d
0000040 e r . c o m / d o w n l o a d /
0000060 2 5 4 0 6 7 5 / f l a t r a t e
0000100 / 1 8 3 9 6 9 8 2 / e e 5 5 0 3
0000120 a 6 f d 3 f 9 f 2 5 8 c 4 c 1 4
0000140 2 b f a a 4 4 c 9 f / d e / B a
0000160 b y l o n _ 5 _ 2 0 . 0 4 . 2 4
0000200 _ 1 9 - 1 0 _ t e l e 5 _ 6 5 _
0000220 T V O O N _ D E . m p g . H Q .
0000240 c u t . m p 4 / 1 1 2 9 7 0 / 2
0000260 9 9 5 8 8 4 8 \r \n
0000271