Having trouble understanding diff. I need to comapre two files, and get a clean result!

Having trouble understanding diff. I need to comapre two files, and get a clean result!

Post by Robert Chalmer » Mon, 10 Jul 2000 04:00:00



I am trying to understand what diff is telling me.

If i have two files.

a        a
b        b
c        c
d        f
e        h
f         i
g        k
h        l
i         m
j         n

Then shouldn't diff tell me - using the "<" symbol, that some of the letters
in the first file, aren't in the second file...

$ diff a b
4,5d3
< d
< e
7d4
< g
10d6
< j
$

And if there are the same number of elements in the files, and they are in
order, it appears to be ok.

But, if the files are not in any order, in either or both files,
like this
File A:
a
b
c
d
e
f
g
h
i
j
k
l
m
n

File B:
a
l
c
f
b
i
k
e
m
n
o
p
q
r
s
t
$

Then the result is that it shows b for example as < and > ????  So it says
it missing from the first file, but also missing from the second file???

$ diff a b
2c2
< b
---

Quote:> l

4,5d3
< d
< e
7,8c5
< g
< h
---
Quote:> b

10d6
< j
12c8
< l
---
Quote:> e

15c11,16
<
---
Quote:> o
> p
> q
> r
> s
> t

$

So how do I compare file A with file B, and return ONLY a list of elements
from file A that are NOT in file B.?

Dashed if I can find any too that will do it.

Thanks a million if anyone has a reasonable solution please..

Riobert

 
 
 

Having trouble understanding diff. I need to comapre two files, and get a clean result!

Post by Stephen Montgomery-Smit » Mon, 10 Jul 2000 04:00:00


Here are a couple of ideas.

1)  You could write a small perl script to do what you want.

2)  You could first sort the files before the diff:

sort file1 > temp1
sort file2 > temp2
diff temp1 temp2


> So how do I compare file A with file B, and return ONLY a list of elements
> from file A that are NOT in file B.?

> Dashed if I can find any too that will do it.

> Thanks a million if anyone has a reasonable solution please..

> Riobert

--
Stephen Montgomery-Smith
Department of Mathematics, University of Missouri, Columbia, MO 65211
Phone 573-882-4540, fax 573-882-1869


 
 
 

1. Having trouble getting good results from nmap.

Hello,
I am trying to use nmap from a buddies machine to see if my linux box
doesn't have any ports open that I don't know about.  But when I run nmap
it says there are a few ports closed, but the rest are filtered.  I have
apache running on 80, and it doesn't even show up.  I am connected using
time warner rr cable, and people can connect to me from outside.  So what
can I use?  Below is the output from nmap.
Thanks,
Brian

(The 1529 ports scanned but not shown below are in state: filtered)
Port       State       Service
1025/tcp   closed      listen                  
1030/tcp   closed      iad1                    
1375/tcp   closed      bytex                  
1400/tcp   closed      cadkey-tablet          
1401/tcp   closed      goldleaf-licman        
1469/tcp   closed      aal-lm                  
1493/tcp   closed      netmap_lm              
1494/tcp   closed      citrix-ica              
1538/tcp   closed      3ds-lm                  
2016/tcp   closed      bootserver              
2022/tcp   closed      down                    
2023/tcp   closed      xinuexpansion3          
2605/tcp   closed      bgpd                    
5302/tcp   closed      hacl-cfg                
5432/tcp   closed      postgres                
5715/tcp   closed      prosharedata            
5998/tcp   closed      ncd-diag                
6142/tcp   closed      aspentec-lm            
8080/tcp   closed      http-proxy              
9992/tcp   closed      issc                    

Nmap run completed -- 1 IP address (1 host up) scanned in 152 seconds

2. HELP: UK win95 keyboard mapping?

3. having trouble getting 'sed' to delete comment lines in source files

4. Compiling Crack

5. finding a dir. size in two ways yields diff. results ?

6. making most

7. having trouble getting sound working...

8. Upgrading Sparc storage arrays (probably a little long)

9. Having trouble getting inbound telnet to work properly (updated)

10. Having trouble getting 3D apps to work

11. Having trouble getting linux box on network

12. I'm having some trouble getting a PCMCIA card to work properly

13. Having trouble getting pgp to compile.