In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces how to use the mmv command to modify the file name in batches, which is very detailed and has a certain reference value. Friends who are interested must finish reading it!
Environment
Centos7.7
Install mmv
By default, there is no mmv installation package in Centos7's network source, so we need to install the Epel source before installing the mmv tool.
# download the epel source file of Aliyun. [root@localhost ~] # wget http://mirrors.aliyun.com/repo/epel-7.repo-- directory-prefix=/etc/yum.repos.d# clears the yum cache and regenerates the cache [root@localhost ~] # yum clean all & & yum makecache# installation MMV [root @ localhost ~] # yum-y install mmv
Rename a file instance using mmv
Example one
To delete duplicate extensions, such as .rar.rar.rar, leaving only one .rar, you can use the following command:
[root@localhost test] # mmv'*. *'# 1.room2'
You can see that the extension has become a .rar. Isn't it convenient.
Example two
If you want to change the file name and extension, but not the sequence number in the file, you can do this:
[root@localhost test] # mmv 'file*.rar'' text#1.zip'
Example three
Convert all files in .jpeg format in the current directory to .jpg format:
[root@localhost test] # mmv'* .jpeg''# 1.jpg'
Example 4
Modify .html.cn, .hml.en, .html.de in the current directory to cn.html,en.html,de.html
[root@localhost test] # mmv'* .html.?
explain
The argument in the first single quotation mark after the Mmv is called From, and the parameter in the second single quote is called To. The wildcards that can be used in From are *,?, [], and;. The wildcard characters that can be used in To are # 1, "2," and 3. Wait. The # sign plus numeric form corresponds to every wildcard in From.
For example:
[root@localhost test] # mmv'* .html.?
In this example, the From mode is'* .html.? 'and the To mode is' # 1. Html. 3. HTML'. There are three wildcards in From mode, *,?,?. The To mode also corresponds to the From mode # 1, "2", "2", 3.
The above is all the contents of the article "how to use the mmv command to modify file names in batches". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.