In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
How does linux compare the differences in file content? In view of this problem, today the editor summarizes this article on document comparison, hoping to help more friends who want to solve this problem to find a more simple and feasible way.
The Linux file comparison command is used to compare the difference between the contents of the two files. There are mainly comm command and diff command. If you want to compare two ordered files, you can use the comm command. If you want to compare two text files line by line, you can use the diff command to list the differences.
Use the common command to compare:
The comm command is a very concise command with only two parameters. However, the three parameters are often used in combination, and our common usage is as follows:
Comm-12 displays only lines that exist in both files
Comm-23 displays only lines that appear in the first file but not in the second file
Comm finds lines in file 2 that are not in file 1:
Comm-23 2.txt 1.txt
Note: the contents of the two files must be sorted by sort before comparing them. Otherwise, the output will be wrong.
Diff command comparison:
The diff command is a classic text comparison tool, and the diff command has more parameters than comm. It is often used in combination with the patch command for patch upgrades. The default is the-a parameter, which compares the differences between the two files line by line. To achieve the desired results here, we also need to work with grep and awk utility:
Diff 2.txt 1.txt | grep "
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.