In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly describes how to use mmv command in linux, has a certain reference value, interested friends can refer to, I hope you read this article after a great harvest, the following let Xiaobian take you to understand.
mmv command is mainly used to rename or move files and directories in Linux system, but it has certain limitations. mmv command does not support renaming multiple files at once.
environment
Centos7.7
Install mmv
By default, there is no mmv installation package in the Centos 7 network feed, we need to install the epel feed first, and then install the mmv tool.
#Download Aliyun's epel source file. [root@localhost ~]# wget http://mirrors.aliyun.com/repo/epel-7.repo--directory-prefix=/etc/yum.repos.d#clear yum cache and regenerate cache [root@localhost ~]# yum clean all && yum makecache#install mmv[root@localhost ~]# yum -y install mmv rename file using mmv Example 1
To remove duplicate extensions, such as.rar.rar.rar, and keep only one.rar, you can use the following command:
[root@localhost test]# mmv '*.*.*.* ' '#1.# 2'
You can see that the extension has become a.rar. If it's convenient.
instance 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' Using mmv command to modify file names in bulk Using mmv command to modify file names in bulk Example 3
Convert all.jpeg files in the current directory to.jpg format:
[root@localhost test]# mmv '*.jpeg' '#1.jpg' Using mmv to modify file names in bulk Using mmv to modify file names in bulk Example 4
Modify.html.cn,.html.en,.html.de in the current directory to cn.html,en.html,de.html
[root@localhost test]# mmv '*.html.?? ' '#1.# 2#3.html'Use mmv command to modify file names in bulk Use mmv command to modify file names in bulk Explanation
The argument in the first single quote after Mmv is called From, and the argument in the second single quote is called To. Wildcards that can be used in From are *,?, []、;。The wildcards that can be used in To are #1,#2,#3…etc.# Sign plus number form, corresponding to each wildcard in From.
For example:
[root@localhost test]# mmv '*.html.?? ' '#1.# 2#3.html'
In this example, the From pattern is '*.html.?? ', To mode is'#1.# 2#3.html'。There are three wildcards in the From pattern, *,?,?. The To mode also corresponds to From modes #1,#2, and #3.
Thank you for reading this article carefully, I hope Xiaobian shared "How to use mmv command in linux" This article is helpful to everyone, but also hope that everyone will support more, pay attention to the industry information channel, more relevant knowledge waiting for you to learn!
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.