Linux paste command details how to use the Linux paste command

Source: Internet
Author: User

The paste command merges each file in a column-to-column manner.

Syntax

Paste [-s] [-d <delimiter>] [-- help] [-- version] [file...]

Parameters:

  • -D <delimiter> or -- delimiters = <delimiter> replace the delimiter with the specified delimiter.

  • -S or -- serial string columns are processed rather than in parallel.

  • -- Help online help.

  • -- Version: displays help information.

  • [File…] File path of the specified operation

Instance

Use the paste command to merge files "file", "testfile", and "testfile1". Enter the following command:

Paste file testfile testfile1 # merge the content of a specified file

However, before executing the preceding commands, run the "cat" command to view the content of the three files, as shown below:

$ Cat file # file content xiongdan 200 lihaihui 233 lymlrl 231 $ cat testfile # content of the testfile liangyuanm ss $ cat testfile1 # content of the testfile1 file huanggai 56 zhixi 73

After the merge command "$ paste file testfile testfile1" is executed, the merged file content is displayed on the program interface, as shown below:

Xiongdan 200 lihaihui 233 lymlrl 231 liangyuanm ss huanggai 56 zhixi 73

If you use the paste command parameter "-s", you can combine multiple rows of data in a file into one row for display. For example, to merge the three data lines in the file into one row for display, enter the following command:

$ Paste-s file # Merge multiple rows of data in a specified file

The data displayed after the preceding command is executed is as follows:

Xiongdan 200 lihaihui 233 lymlrl 231

Note: The "-s" parameter only adjusts the display mode of the content of the testfile and does not change the content format of the original file.

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.