Linux Common Commands Summary--rename

Source: Internet
Author: User

Rename This command is used to modify the file name, especially for batch modification of files with similar formatting.

Rename used in the format: rename the file string to replace after the file string is applied to the range

The use of rename can be understood from the example:

1) Create Foo1 to Foo50, foo_1 to foo_50 files:

For i in ' seq 1 50 '

Do

Touch Foo${i}

Touch Foo_${i}

Done


650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/80/4E/wKioL1c9j62xyKrIAAAtFR_oJVU468.png "title=" Clipboard.png "alt=" Wkiol1c9j62xykriaaatfr_ojvu468.png "/>

650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/>

2) Change foo_1 to Foo_50 to Test_1 to Test_50, and foo1 to foo50 name unchanged

[email protected] test]# rename foo Test foo_*

[[email protected] test]# ls

Foo1 foo15 foo20 foo26 foo31 foo37 foo42 foo48 foo8 test_13 test_19 test_24 test_3 test_35 test_40 tes t_46 Test_6

Foo10 foo16 foo21 foo27 foo32 foo38 foo43 foo49 foo9 test_14 test_2 test_25 test_30 test_36 test_41 tes T_47 test_7

Foo11 foo17 foo22 foo28 foo33 foo39 foo44 foo5 test_1 test_15 test_20 test_26 test_31 test_37 test_42 tes t_48 Test_8

Foo12 foo18 foo23 foo29 foo34 foo4 foo45 foo50 test_10 test_16 test_21 test_27 test_32 test_38 test_43 tes t_49 Test_9

Foo13 foo19 foo24 foo3 foo35 foo40 foo46 foo6 test_11 test_17 test_22 test_28 test_33 test_39 test_44 tes T_5

Foo14 foo2 foo25 foo30 foo36 foo41 foo47 foo7 test_12 test_18 test_23 test_29 test_34 test_4 test_45 tes T_50


Linux Common Commands Summary--rename

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.