Compare two files UNMATCH in solaris


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Compare two files UNMATCH in solaris
# 1  
Old 10-22-2008
Bug Compare two files UNMATCH in solaris

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:

Code:
#! /usr/bin/bash

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

comm -12 file261a file262a

Thanks

Last edited by Neo; 10-22-2008 at 04:40 PM.. Reason: Added code tags.
# 2  
Old 10-22-2008
Hammer & Screwdriver try the comm command with a -3

Code:
> comm -3 file261a file262a
        bppr00rsm
def01asp
efg00asy
        ppr00rsm
rkl01atm
        ypr00rsm

# 3  
Old 10-22-2008
what about diff??

Code:
diff file261a file262a

# 4  
Old 10-22-2008
Thanks,
it works fine but i just needed them in 1 single column.
# 5  
Old 10-22-2008
Hammer & Screwdriver

Code:
> comm -3 file261a file262a | tr -d "^[ \t]"
bppr00rsm
def01asp
efg00asy
ppr00rsm
rkl01atm
ypr00rsm

Above will eliminate leading space or tab characters.
# 6  
Old 10-22-2008
my input file is huge so if you can help to them in one column it will be great.

thanks
# 7  
Old 10-22-2008
Thanks, the logic works for this example but for the actual server it is duplicating files in both area, whereas i need to have files they don't unmatch. Here is the code:

Code:
#! /usr/bin/bash

cut -d":" -f1 /export/hm/sst/dba/inc/ips.db | sort >un.exipfile1
tr "\t" " " </etm/ihosts | cut -d" " -f2 | sort >un.hostfile1


comm -3 un.exipfile1 un.hostfile1 | tr -d "^[ \t]"


Last edited by Neo; 10-22-2008 at 04:41 PM.. Reason: Added code tags.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

To take unmatch field in first column

Im uising the below command to take the matching pattern on 1st filed awk 'NR==FNR{_;next}$4 in _' file1 file2 file1 12 sam kash 232 f10 kash 22 data kas file2 56 789 232 Needed output: 12 22 (1 Reply)
Discussion started by: Roozo
1 Replies

2. Shell Programming and Scripting

Running two scripts and then compare match or unmatch

Hello ! I need to run two diff script to two different remote server and then compare flies from server3. script1 - server 1 - /xxx/xxx/dir scrpt 2 - server 2 /xxx/xxx/dir script1 already will generate script1.output1 and script2 also will generate script2.output2 Compare: ... (2 Replies)
Discussion started by: amir07
2 Replies

3. Solaris

Compare 2 Solaris 10 servers

Hi, I've two Solaris 10 installed with jumpstart about 3 month ago. Now, I need to compare the both servers to see if all the configurations, installed software and so on are identical. How to proceed? Should I check each file with diff or is it a quicker solution? Best regards, H. (2 Replies)
Discussion started by: hiddenshadow
2 Replies

4. Shell Programming and Scripting

Compare multiple files, and extract items that are common to ALL files only

I have this code awk 'NR==FNR{a=$1;next} a' file1 file2 which does what I need it to do, but for only two files. I want to make it so that I can have multiple files (for example 30) and the code will return only the items that are in every single one of those files and ignore the ones... (7 Replies)
Discussion started by: castrojc
7 Replies

5. Shell Programming and Scripting

Require compare command to compare 4 files

I have four files, I need to compare these files together. As such i know "sdiff and comm" commands but these commands compare 2 files together. If I use sdiff command then i have to compare each file with other which will increase the codes. Please suggest if you know some commands whcih can... (6 Replies)
Discussion started by: nehashine
6 Replies

6. Shell Programming and Scripting

Compare 2 folders to find several missing files among huge amounts of files.

Hi, all: I've got two folders, say, "folder1" and "folder2". Under each, there are thousands of files. It's quite obvious that there are some files missing in each. I just would like to find them. I believe this can be done by "diff" command. However, if I change the above question a... (1 Reply)
Discussion started by: jiapei100
1 Replies

7. Shell Programming and Scripting

How to compare 2 files & get only few columns based on a condition related to both files?

Hiiiii friends I have 2 files which contains huge data & few lines of it are as shown below File1: b.dat(which has 21 columns) SSR 1976 8 12 13 10 44.00 39.0700 70.7800 7.0 0 0.00 0 2.78 0.00 0.00 0 0.00 2.78 0 NULL ISC 1976 8 12 22 32 37.39 36.2942 70.7338... (6 Replies)
Discussion started by: reva
6 Replies

8. Shell Programming and Scripting

compare files in two directories and output changed files to third directory

I have searched about 30 threads, a load of Google pages and cannot find what I am looking for. I have some of the parts but not the whole. I cannot seem to get the puzzle fit together. I have three folders, two of which contain different versions of multiple files, dist/file1.php dist/file2.php... (4 Replies)
Discussion started by: bkeep
4 Replies

9. Shell Programming and Scripting

compare two files and to remove the matching lines on both the files

I have two files and need to compare the two files and to remove the matching lines from both the files (4 Replies)
Discussion started by: shellscripter
4 Replies

10. Shell Programming and Scripting

compare two files for matching in solaris

I am using solaris, need either awk/shell or perl script to compate two files. both of these file1 and file2 are located in two diffent location path in the same server. file1 location: /export/db/mna file2: /etc/dba The script will compare in file1 first field (e.g. abc00asp)before colon:... (8 Replies)
Discussion started by: amir07
8 Replies
Login or Register to Ask a Question