The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM



View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 01-21-2008
varungupta varungupta is offline
Registered User
 

Join Date: Feb 2007
Location: Pune, Dehradun (INDIA), Michigan(US)
Posts: 187
Lightbulb Compare 2 sorted files

Hi all,

please give me the commands using which i can compare 2 sorted files and get the difference in third file, indiating where the difference is from either file1 or file2.

as:

File1 (Original file)

GARRY
JOHN
JULIE
SAM

---------------
File2

DEV
GARRY
JOHN
JOHNIEE
JULIE
RAMEE
SAM
SAMYEE
-------------------
OUTPUT in file3 should have :

DEV
JOHNIEE
RAMEE
SAMYEE


Using awk and diff/cmp commands.
Reply With Quote
Remove advertisements
!!
!! Forum Sponsor