Computing.Net > Forums > Programming > Compare two files for unmatch

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Compare two files for unmatch

Reply to Message Icon

Name: jacky599
Date: October 22, 2008 at 06:32:27 Pacific
OS: solaris
CPU/Ram: solaris
Comment:

I have these following code, which give me output of a match items. Can any please help me to reverse the code so that I can get UNMATCH items:

#! /usr/bin/bash

cut -d":" -f1 file261 | sort >file261a
tr "\t" " " <file262 | cut -d" " -f2 | sort >file262a

comm -12 file261a file262a


Thanks



Sponsored Link
Ads by Google

Response Number 1
Name: chao
Date: November 11, 2008 at 02:04:41 Pacific
Reply:

Looks like you could try

( comm -13 file261a file262a; comm -23 file261a file262a ) | sort

That'll put the stuff back in order, in case you needed it that way. If not, just get rid of the | sort.

You could also just say

comm -3 file261a file262a

but that gives me some (probably undesirable) tabs in front of the lines from file262a. You'd probably need to sed those out.


0
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Compare two files for unmatch

Compare two files for match -solari www.computing.net/answers/programming/compare-two-files-for-match-solari/17142.html

Compare two files with an input fil www.computing.net/answers/programming/compare-two-files-with-an-input-fil/17089.html

Comparing two files www.computing.net/answers/programming/comparing-two-files/13292.html