![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| concatenate files sorted by date | docaia | Shell Programming and Scripting | 2 | 08-15-2008 11:23 PM |
| executing code on files in the sorted order -help! | epi8 | Shell Programming and Scripting | 1 | 05-20-2008 12:30 AM |
| Compare two files | amir07 | Shell Programming and Scripting | 6 | 03-26-2008 08:23 AM |
| Compare files | kharen11 | UNIX for Advanced & Expert Users | 25 | 03-14-2007 02:35 AM |
| help! need to compare files | danielsf | Shell Programming and Scripting | 6 | 07-09-2003 02:09 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
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. |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
Try this:
Code:
comm -13 file1 file2 Code:
diff file1 file2 | awk '/^>/{print $2 }'
|
|
#3
|
|||
|
|||
|
Quote:
Could you please tell me why -13 is being used in comm command ? |
|
#4
|
|||
|
|||
|
Try this one
grep -x -v -f F1 F2
|
|
#5
|
|||
|
|||
|
Hey,
thanks man, hope this'll work fine. Varun. |
|
#6
|
|||
|
|||
|
Quote:
-1 suppress lines unique to left file -2 suppress lines unique to right file -3 suppress lines that appear in both files |
|
#7
|
|||
|
|||
|
Hey,
I have attached 2 files in this mail, please find those, in which i am doing comparisions. Contents of EAIDVBR1.txt are standard and Contents of EAIDQBR1.txt are mixed. I want list of all strings from EAIDQBR1.txt that are not there in EAIDVBR1. Please have a look and let me know. As i have tries "grep -x -v -f F1 F2" command on these files and its not working effectively. Let me know asap. Thanks Varun |
|||
| Google The UNIX and Linux Forums |