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 comm command of Linux

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

Most people do not understand the knowledge points of this article "Linux's comm command how to use", so the editor summarizes the following content, detailed content, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "Linux comm command how to use" article.

Prepare the files 1.txt and 2.txt

[h_chenliling@vm6-sj1-pro-had-32-107] $cat 1.txtabcdef1234567 [h _ chenliling@vm6-sj1-pro-had-32-107] $cat 2.txtdefghi1234567 [h _ chenliling@vm6-sj1-pro-had-32-107] $comm 1.txt 2.txtabc defgh i12345678910

The first column contains only the rows that appear in 1.txt, the second column contains the rows that appear in 2.txt, and the third column contains the same rows in 1.txt and 2.txt. Each column is delimited by a tab (\ t).

Intersection

Delete columns 1 and 2

[h_chenliling@vm6-sj1-pro-had-32-107] $comm 1.txt 2.txt-1-2def1234 difference set

The difference of 1.txt exists in 1.txt, but not in 2.txt. That is, delete columns 2 and 3.

[h_chenliling@vm6-sj1-pro-had-32-10710] $comm 1.txt 2.txt-2-3abc1234 difference

For different lines of two files, delete column 3 and merge column 1 and column 2

[h_chenliling@vm6-sj1-pro-had-32-10710] $comm 1.txt 2.txt-3 | sed's / ^\ t//'abcghi is about the article "how to use Linux's comm commands". I believe you all have some understanding. I hope the content shared by the editor will be helpful to you. If you want to know more about it, please follow the industry information channel.

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