The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
Google UNIX.COM



Thread: map comparsion
View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 08-30-2007
jim mcnamara jim mcnamara is offline
...@...
 

Join Date: Feb 2004
Location: NM
Posts: 4,365
Use find to create a file that has checksums. Do it on box1 and then box2.
Code:
find /path/to/maps -type f  -exec cksum {} \; | awk '{print $3, $2, "box1" }' > box1.lis
find /path/to/maps -type f  -exec cksum {} \; | awk '{print $3, $2, "box2" }' > box2.lis
Next, merge the two files into one larger file with sort.

Now you can awk to find the duplicates, and the checksums tell you if the files are the same or not. box1.lis and box2.lis tell you the names of all of the files on each box.

If this did not so homework-ish, I'd show the awk code.
Reply With Quote