http://www.somesite/play/episodes/xyz/fred-episode-110
http://www.somesite/play/episodes/abc/simon-episode-266
http://www.somesite/play/episodes/qwe/mum-episode-39
http://www.somesite/play/episodes/zxc/dad-episode-41
http://www.somesite/play/episodes/asd/bob-episode-57
我有很多网址保存在上面显示的txt文件中 我希望在第6个反斜杠后用脚本
移动一行第6个反斜杠之后的txt是标题并且始终不同 我需要选择标题,以便我可以播放
所以我需要它看起来像这样
fred-episode-110
http://www.somesite/play/episodes/xyz/fred-episode-110
simon-episode-266
http://www.somesite/play/episodes/abc/simon-episode-266
mum-episode-39
http://www.somesite/play/episodes/qwe/mum-episode-39
dad-episode-41
http://www.somesite/play/episodes/zxc/dad-episode-41
bob-episode-57
http://www.somesite/play/episodes/asd/bob-episode-57
我有
SED
AWK
wget的
可以这样做
答案 0 :(得分:1)
使用此命令:
awk -F/ '{print $7; print $0}'
E.g:
awk -F/ '{print $7; print $0}' < file.txt > new-file.txt
答案 1 :(得分:-1)
只是添加到此
awk -F/ '{print $7; print $0}' < file.txt > new-file.txt
无论如何都要从标题中删除所有连字符并留出空格 一些标题有很多连字符 并且它使用连字符读取有点困难
更改这些
simon-episode-2-playing-football-in-the-park
fred-episode-110-the-big-clash-tonight
bob-episode-57
到
simon episode 2 playing football in the park
fred episode 110 the big clash tonight
bob episode 57
感谢您的专业知识和时间