Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-04-2005 04:14 PM
тАО10-04-2005 04:14 PM
I hv 2 files called 1 and 2.
Content of 1
============
tls
norainij
abcd
tyt
Content of 2
============
abcd
I want to comm these 2 files and the output that I want is only
tls
norainij
tyt
The command that I use is comm -3 1 2 but the output is as below
abcd
tls
norainij
abcd
tyt
May I know what is the problem?
regards.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-04-2005 04:22 PM
тАО10-04-2005 04:22 PM
Re: comm
comm -23 file1 file2
Read the man page carefully and pay special attention to exmaples section.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-04-2005 04:23 PM
тАО10-04-2005 04:23 PM
Re: comm
comm reads file1 and file2, which should be ordered in increasing
collating sequence (see sort(1) and Environment Variables below), and
produces a three-column output:
Column 1: Lines that appear only in file1,
Column 2: Lines that appear only in file2,
Column 3: Lines that appear in both files.
So, you have to sort file1 before doing anything.
Try this,
# sort one >three (Sort one and store it in three)
# comm -23 three two
norainij
tls
tyt
-Arun
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-04-2005 06:03 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-04-2005 06:09 PM
тАО10-04-2005 06:09 PM
Re: comm
# grep -vf file2 file1
tls
norainij
tyt
hth.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-05-2005 09:14 AM
тАО10-05-2005 09:14 AM
Re: comm
# sort f1 | comm -23 - f2
OR
# sort f1 > f1.out; sort f2 > f2.out; comm -23 f1.out f2.out
regards!