Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the common command paste in Linux

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces the Linux commonly used command paste how to use, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let Xiaobian take you to understand.

The Linux common command paste command is used to merge the columns of a file, and the paste directive merges each file column by column.

Syntax paste [- s] [- d] [--help] [--version] [file..] Parameters:

-d or-delimiters= replaces the tabbed character with the specified interval character.

-s or-serial serial rather than parallel processing.

-help online help.

-version displays help information.

[file...] Specify the file path for the operation

The instance uses the paste instruction to merge the files "file", "testfile" and "testfile1", and enter the following command:

Paste file testfile testfile1 # merges the contents of the specified files, but before executing the above command, first use the "cat" directive to view the contents of the three files, as shown below:

Contents of $cat file # file file xiongdan 200 lihaihui 233 lymlrl 231$ cat testfile # testfile file contents of liangyuanm ss $cat testfile1 # testfile1 file huanggai 56 zhixi 73 when the merge instruction "$paste file testfile testfile1" is executed, the contents of the merged file will be displayed in the program interface as follows:

Xiongdan 200 lihaihui 233 lymlrl 231 liangyuanm ss huanggai 56 zhixi 73 if you use the parameter "- s" of the paste instruction, you can merge multiple lines of data in a file into one line for display. For example, to merge three lines of data from the file "file" into one row of data to display, enter the following command

After the command above merging multiple lines of data from the specified file is executed by $paste-s file #, the data content displayed is as follows:

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

Thank you for reading this article carefully. I hope the article "how to use Linux commands paste" shared by the editor will be helpful to everyone. At the same time, I hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report