[Shell Foundation]--paste Command

Source: Internet
Author: User

The test text content is as follows:

# cat Name1.txt name1 alvin1name2 alvin2name3 alvin3name4 alvin4# cat name2.txt name1 100name2 101name3 102CCCCCCCCCCCCCCC C

(1) Paste merge each line of two files by one by one

# paste Name1.txt name2.txtname1 alvin1 name1 100name2 alvin2 name2 101name3 alvin3 name3 102name4 alvin4 CCCCCCCCCCCCCCCC


(2)-D specifies what to use as a delimiter when merging

# paste-d: Name1.txt name2.txtname1 alvin1:name1 100name2 alvin2:name2 101name3 alvin3:name3 102name4 ALVIN4:CCCCCCCCCCC Ccccc


(3)-s outputs each column in a horizontal manner

# paste-s name1.txtname1 alvin1 name2 alvin2 name3 alvin3 name4 alvin4# paste-s name1.txt name2.txtname1 alvin1 name2 al Name3 alvin3 name4 alvin4name1 vin2 name2 101 Name3 102 CCCCCCCCCCCCCCCC


(4) ----Specify each n column as a row output

Output per 2 columns as a line # cat Name1.txt | Paste--name1 alvin1 name2 alvin2name3 alvin3 name4 alvin4 every 3 columns as a row output # cat Name1.txt | Paste-d ""---name1 alvin1 name2 alvin2 name3 alvin3name4 alvin4 per 4 columns as a row output # cat Name1.txt | Paste----name1 alvin1 name2 alvin2 name3 alvin3 name4 alvin4 can be used with-D to specify delimited symbols # cat name1.txt  | paste-d ";"   ---name1 alvin1;name2 alvin2;name3 alvin3name4 alvin4;



[Shell Foundation]--paste Command

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.