LinuxShell command -- rename

Source: Internet
Author: User
The LinuxShell command-rename file, often using the mv command, rename files in batches is the best choice, Linux rename command has two versions, one is the C language version, one is in the Perl language, and the judgment method is: enter manrename to see the first line is... linux Shell command-rename file, often using mv command, rename files in batches is the best choice, Linux rename command has two versions, one is the C language version, one is in the Perl language. Judgment method: enter man rename to see that the first line is RENAME (1) Linux Programmer's Manual RENAME (1) this is the C language version-I use the C language version, and if RENAME (1) Perl Programmers Reference Guide RENAME (1) appears, this is the C language version format of the Perl version: rename new string file name Example 1: Two files exist in directory test: a_01 and a_02. if you need to replace a with B in the file name and the other parts remain unchanged, (1) if it is currently in the test Directory, run rename a B * (2) if it is in the parent directory of test, run the rename a B test/* Perl language version format: rename's/original string/new string/'file name Example 2: question example 1, if (1) is currently in the test Directory, run rename's/a/B/'* (2). If the current directory is in the parent directory of test, run the rename's/a/B' test/* script implementation method: [python] find-name "a *"-print | while read name do echo $ name rename's/a/B/'$ name done
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.