标题: [问题求助] [已解决]求助sed替换文本问题 [打印本页]
作者: lijinan 时间: 2016-4-9 16:32 标题: [已解决]求助sed替换文本问题
本帖最后由 lijinan 于 2016-5-10 21:07 编辑
测试文件名称为“风潮-遇见米拉拉.cue"- PERFORMER "风潮音乐"
- TITLE "TCD-9200 遇见米拉拉"
- FILE "CDImage.wav" WAVE
- TRACK 01 AUDIO
- TITLE "旅程"
- PERFORMER " 林慧玲"
- INDEX 01 00:00:00
- TRACK 02 AUDIO
- TITLE "Missing You "
- PERFORMER "林慧玲"
- INDEX 00 05:47:54
- INDEX 01 05:49:54
- TRACK 03 AUDIO
- TITLE " 风之歌 (演唱曲)"
- PERFORMER "林慧玲"
- INDEX 00 09:26:67
- INDEX 01 09:28:67
- TRACK 04 AUDIO
- TITLE "那年夏天的海"
- PERFORMER "林慧玲 "
- INDEX 00 13:51:06
- INDEX 01 13:53:06
- TRACK 05 AUDIO
- TITLE "春天笑了"
- PERFORMER "林慧玲"
- INDEX 00 18:29:42
- INDEX 01 18:31:42
- TRACK 06 AUDIO
- TITLE "旅行的人鱼"
- PERFORMER "林慧玲"
- INDEX 00 21:56:14
- INDEX 01 21:58:12
- TRACK 07 AUDIO
- TITLE "摇摆的黄围裙"
- PERFORMER "林慧玲"
- INDEX 00 26:09:72
- INDEX 01 26:11:72
- TRACK 08 AUDIO
- TITLE "换季"
- PERFORMER "林慧玲"
- INDEX 00 29:18:05
- INDEX 01 29:20:05
- TRACK 09 AUDIO
- TITLE "微笑天堂"
- PERFORMER "林慧玲"
- INDEX 00 33:35:08
- INDEX 01 33:37:08
- TRACK 10 AUDIO
- TITLE "我心中住着一只猫"
- PERFORMER "林慧玲"
- INDEX 00 37:14:73
- INDEX 01 37:16:72
- TRACK 11 AUDIO
- TITLE "鸟儿巴娜娜"
- PERFORMER "林慧玲"
- INDEX 00 41:27:71
- INDEX 01 41:29:71
- TRACK 12 AUDIO
- TITLE "花语 (演唱曲)"
- PERFORMER "林慧玲"
- INDEX 00 44:34:74
- INDEX 01 44:36:74
复制代码
使用gun sed命令- sed "s/CDImage.wav/%%~nf.flac/g;s/风潮音乐/风潮/g;1,/TITLE.*/s//TITLE \"遇见米拉拉\"/"
复制代码
实现cue文件文本替换。
存在如下问题:
1、将第一个”TITLE“行替换后,没有办法换行;
2、文本内容中部分”前、后的空格无法去除。
请大侠帮忙。
作者: gawk 时间: 2016-4-9 17:29
用的哪个版本?试试4.2.1和4.2.2
http://www.bathome.net/s/tool/index.html?key=sed
作者: happy886rr 时间: 2016-4-9 18:51
- sed -i "s/CDImage.wav/%%~nf.flac/g;s/风潮音乐/风潮/g;s/^ *//g;1,/TITLE.*/s//TITLE \"遇见米拉拉\"/" test.txt
复制代码
回复 1# lijinan
作者: lijinan 时间: 2016-5-10 21:06
已解决,使用unix2dos解决换行问题。
欢迎光临 批处理之家 (http://bbs.bathome.net/) |
Powered by Discuz! 7.2 |