2014-12-27 93 views
1

我需要从当前mc面板中的文件名中剪下一些第一个字符,然后在这个名称的pastive mc面板中创建硬链接。例如:linux mc扩展命令与DOT结尾

ls 001-a\ b.flac | cut -c 5- | xargs -0 -I{} echo ln %p %D/{} 

我得到expectet结果:

ln 001-a b.flac /srv/Music/a b.flac 

但是,没有回音:

ls 001-a\ b.flac | cut -c 5- | xargs -0 -I{} ln %p %D/{} 

我得到的结果:

ln 001-a b.flac /srv/Music/a b.flac. 

随着DOT在年底文件名称在面板

我找到类似的问题how to remove final “dot” from directory name。但是,如何在mc扩展命令的文件名末尾避免这种DOT?

PS
问题上的表达在MC扩展文件:

regex/i/\.flac 
Open=ls %p | cut -c 5- | xargs -0 -I{} ln %p %D/{} 

加入溶液?

怎么能有硬链接和歌曲refactory名字在里面我"How can i pass all arguments with xargs in middle of command in linux"

ln %p %D/"`ls %p | cut -c 5- `" 

它工作在MC envirounment发现播放列表仅

回答

0

你有没有考虑过用查找/ sed将修改名称?

find . -name "001-a b.flac" -maxdepth 0 -print0 | sed 's/001-//g' | xargs -0 -I{} ln %p %D/{} 

然后,你当然可以使sed的比较通用:

sed 's/[[:digit:]]\+-//g' 

我不知道什么是“MC”是,所以我的答案可能不是正是你需要的。祝你好运。

+0

MC发现播放列表 - 午夜指挥官在linux – user1855805 2017-01-26 10:00:31