Batch generation of commands with serial numbers

Source: Internet
Author: User
Tags linux

Recently encountered a case, to the RAC plus bare equipment, and because the customer environment is more special can not use a number of batch editing tools, eh, want to be lazy!

Here is a summary of the use of Linux, Unix with the tools to batch generation with serial number commands, other commands can also see your actual needs.

(1), the first example is the batch build LV command

Eg: Generate sequential commands in batches (the following commands can be executed directly under the CAMMD interface):

For i in {1..5};

Todo

echo "Mklv-y ' tdata_16g_$i '-t ' raw ' rac_data2_b 128" >>/tmp/mklv.sh

Done

Output results:

[root@ora10g tmp]# for i in {1..5};

> Do

> echo "mklv-y ' tdata_16g_$i '-t ' raw ' rac_data2_b 128"

> Done

Mklv-y ' tdata_16g_1 '-t ' raw ' rac_data2_b 128

Mklv-y ' tdata_16g_2 '-t ' raw ' rac_data2_b 128

Mklv-y ' tdata_16g_3 '-t ' raw ' rac_data2_b 128

Mklv-y ' tdata_16g_4 '-t ' raw ' rac_data2_b 128

Mklv-y ' tdata_16g_5 '-t ' raw ' rac_data2_b 128

(2), use VI of the replacement command to bulk edit

Basic serial number Generation command:

For i in {1..10000000};

Todo

Echo $i

Done

1> add a string at the end of a row

Use the following command to add the string "NewString" at the beginning of each line of text, note that the space exists.

: g/^/s//newstring/g

:%s/^/newstring/g

Add the string "NewString" at the end of each line with the following command:

: g/$/s//newstring/g

:%s/$/newstring/g

Inserts the string "NewString" from line 3rd of the text to the beginning of the last line:

:%s//\r/g-----------------(substitute replace, global Globals, \ r return line feed) 1 spaces replaced with 1 carriage returns

:%s/,/\r/g-----------------(Kiki,dada,mina,jiangdingyong,jiangkun,xufuli,lichengyang) 1 commas replaced with 1 carriage returns

:%s/:/\r/g--------------(Kiki:lichengyang:mina:dada) 1 colons replaced with 1 carriage returns

:%s/kiki/sunny/g-------------------Kiki are replaced sunny

This column more highlights: http://www.bianceng.cnhttp://www.bianceng.cn/OS/Linux/

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.