2014-12-27 91 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