使用帶有linux的正則表達式重命名文件

[英]renaming files using regular expression with linux


I have read quite a few questions here and on the interwebz, however my file renaming still doesn't work. I've got a bunch of files that starts as follows:

我在這里和interwebz上已經閱讀了很多問題,但是我的文件重命名仍然不起作用。我有一堆文件,如下所示:

libraryVCE_KM_LIBRARY_SUMARY_S...

I want to remove the first instance of library, so I run this command in linux:

我想刪除第一個庫實例,所以我在linux中運行這個命令:

rename -v '/\blibrary/' *

However no files are renamed. Why not?

但是沒有重命名文件。為什么不?

2 个解决方案

#1


1  

I tried this:

我試過這個:

rename library '' *

And it seems to work.

它似乎工作。

#2


2  

Try this:

嘗試這個:

rename 's/^library//' *

注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:https://www.itdaan.com/blog/2013/08/28/729ba0c42287ff24ead7ddaa42ae4ffb.html



 
粤ICP备14056181号  © 2014-2020 ITdaan.com