Company colleagues today to find me help modify the filename, I see, well, hundreds of files to rename, file name format is _01.png _02.png so in turn, colleagues asked the front of the "_" to remove, fortunately, the request is simple, did not let me change to another name.
An order to fix:
Copy Code code as follows:
For i in ' LS _*.png '; Do mv "$i" "echo" $i "|awk-f ' _0 '" {print $0 "$}"; Done
If you want to get rid of the _0, so write:
Copy Code code as follows:
For i in ' LS _*.png '; Do mv "$i" ' echo ' $i ' |awk-f ' _0 ' {print $1,$2} '; Done
OK, this is done, and then give you some other similar orders, the following command I did not verify that there are problems do not look for me oh.
*_ the format? JPG file changed to *_0? Jpg:
Copy Code code as follows:
For i in ' ls *_?. JPG '; Do mv "$i" ' echo "$i" |awk-f ' _ ' "{print $" _0 "$}"; Done
Change the first three letters of a filename into vzomik:
Copy Code code as follows:
For i in ' ls '; Do mv-f "$i" ' echo ' $i ' |sed ' s/^.../vzomik/'; Done
Turn the four letters of the filename into vzomik:
Copy Code code as follows:
For i in ' ls '; Do mv-f "$i" ' echo ' $i ' |sed ' s/....$/vzomik/'; Done