compare version file


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers compare version file
# 1  
Old 03-02-2009
compare version file

i have 2 files: file1 and file2.

file1 has 7000 lines

file2 has 7001 lines

i used:

sdiff file1 file2 and it shows diff at line 7001.

also used:

diff file1 file2 > file3
patch -p0 < file3 file1 and it shows diff at line 7001

how do i find out the additional line ?
# 2  
Old 03-02-2009
Try this :

Code:
$ sdiff -s file1 file2

# 3  
Old 03-02-2009
i tried that, and it showed me this:
vldbtchprms: 9.0.0.6.175 2008-08-06 04:00:00 (200811) | vwdblog: 9.0.0.6.175 2008-08-06 04:00:00
vwdblog: 9.0.0.6.175 2008-08-06 04:00:00 (200811) | workdef: 9.0.0.6.175 2008-08-06 04:00:00
workdef: 9.0.0.6.175 2008-08-06 04:00:00 (200811) | workdump: 9.0.0.6.175 2008-08-06 04:00:00
workdump: 9.0.0.6.175 2008-08-06 04:00:00 (200811) | workload: 9.0.0.6.175 2008-08-06 04:00:00
workload: 9.0.0.6.175 2008-08-06 04:00:00 (200811) | wtsubmit: 9.0.0.6.175 2008-08-06 04:00:00
wtsubmit: 9.0.0.6.175 2008-08-06 04:00:00 (200811) | xferreq: 9.0.0.6.175 2008-08-06 04:00:00
xferreq: 9.0.0.6.175 2008-08-06 04:00:00 (200811) | xlarw: 9.0.0.6.175 2008-08-06 04:00:00
xlarw: 9.0.0.6.175 2008-08-06 04:00:00 (200811) | xltrpt: 9.0.0.6.337 2009-01-21 04:00:00
xltrpt: 9.0.0.6.337 2009-01-21 04:00:00 (200811) | xscrgen: 9.0.0.6.337 2009-01-21 04:00:00
xscrgen: 9.0.0.6.337 2009-01-21 04:00:00 (200811) <

xscrgen exists in file1 and file2

file2 has one more line than file1, and i just want to know which filename ?
# 4  
Old 03-02-2009
The files dont have the same format (one is ending with (200811)). Its normal that diff or sdiff will show lots of differences.

Try this:

Code:
$ sed -e "s/(200811)//g" file1 | sort -u > file3
$ sort -u file2 > file4
$ sdiff -s file3 file4

# 5  
Old 03-02-2009
thanks guy. sdiff works perfectly.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script (sh file) logic to compare contents of one file with another file and output to file

Shell script logic Hi I have 2 input files like with file 1 content as (file1) "BRGTEST-242" a.txt "BRGTEST-240" a.txt "BRGTEST-219" e.txt File 2 contents as fle(2) "BRGTEST-244" a.txt "BRGTEST-244" b.txt "BRGTEST-231" c.txt "BRGTEST-231" d.txt "BRGTEST-221" e.txt I want to get... (22 Replies)
Discussion started by: pottic
22 Replies

2. UNIX for Beginners Questions & Answers

Getting the version from jar file

Hi, I am trying to retrieve the "Implementation version" from one of the .jar file The command which tried is as below. find /usr/local/platform -name "platform.jar" -exec zipgrep "Implementation-Version:" '{}' \;|awk -F ': ' '{print $2}'I am able to get the version as below 2.9.0-29But... (2 Replies)
Discussion started by: nextStep
2 Replies

3. UNIX for Beginners Questions & Answers

UNIX utility to find difference in folder, file and contents of file against a base version

Hi, I am trying to find out whether there are any Unix utilities that compares folders, files and contents within the file and provides a comprehensive report. The comparison can be against base version of a folder and file with content. Can you please let me know of such a utility? Thanks,... (6 Replies)
Discussion started by: Sripathi_ks
6 Replies

4. Shell Programming and Scripting

Compare two files containing package names and version number

I have 2 files each containing a list of same fedora packages but with different version number. I want to compare the 2 files and remove the lines containing a newer or older version number (1 Reply)
Discussion started by: asya18
1 Replies

5. Shell Programming and Scripting

Compare 2 text file with 1 column in each file and write mismatch data to 3rd file

Hi, I need to compare 2 text files with around 60000 rows and 1 column. I need to compare these and write the mismatch data to 3rd file. File1 - file2 = file3 wc -l file1.txt 58112 wc -l file2.txt 55260 head -5 file1.txt 101214200123 101214700300 101250030067 101214100500... (10 Replies)
Discussion started by: Divya Nochiyil
10 Replies

6. Shell Programming and Scripting

Compare new version of two directory

How to compare new version exist of two path directory. for e.g., path1 - /user/path/test/ path2 - /user/path/score/ If its exist new version then copy that new version into the first path directroy. How will do this. (3 Replies)
Discussion started by: roy1912
3 Replies

7. Shell Programming and Scripting

Copy a file from directroy/ prior version to the directory/ new version

How to copy a file from directroy/ prior version to the directory/ new version automatically. (4 Replies)
Discussion started by: roy1912
4 Replies

8. Shell Programming and Scripting

Match list of strings in File A and compare with File B, C and write to a output file in CSV format

Hi Friends, I'm a great fan of this forum... it has helped me tone my skills in shell scripting. I have a challenge here, which I'm sure you guys would help me in achieving... File A has a list of job ids and I need to compare this with the File B (*.log) and File C (extend *.log) and copy... (6 Replies)
Discussion started by: asnandhakumar
6 Replies

9. Shell Programming and Scripting

How to compare version values in shell script?

Hi, I need to compare two versions values and report only true or false depending on their difference result. like - echo $(echo "1.8 >= 2.0" | bc) 0 echo $(echo "2.0 >= 2.0" | bc) 1 but my task is to compare values like - echo $(echo "1.9.1 >= 2.0" | bc) (standard_in) 1: syntax... (3 Replies)
Discussion started by: abhitanshu
3 Replies

10. Shell Programming and Scripting

Compare 2 different file version and prompt for action

Hi, I need some assistance with comparing 2 diff application. The format of the first file is in TAR "filename.1.2.3.tar" . The second file is a running application for which i need to find the version and then prompt the user for action as below :- Once compared, It needs to prompt the user,... (0 Replies)
Discussion started by: systemali
0 Replies
Login or Register to Ask a Question