Line by Line Comparision of 2 files and print only the difference


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Line by Line Comparision of 2 files and print only the difference
# 1  
Old 05-18-2010
Line by Line Comparision of 2 files and print only the difference

Hi,

I am trying to find an alternative way to do tkdiff. In tkdiff the gui compares each line and highlights only the differences.

for eg:
Code:
 
 
John works at McDonalds s(test)
He was playing guitar [32823sd12] tywejk

Code:
 
 
John works in McDonalds 9908
He was playing guitar [3282312]

I am trying to get the output

Code:
 
 
at,in  s(test),9908
[32823sd12],[3282312] tywejk,

Can someone suggest a solution for this??

Appreciate your help as always.
thanks,
Naveen
# 2  
Old 05-19-2010
Whats wrong with diff(1)?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Comparing two files and list the difference with common first line content of both files

I have two file as given below which shows the ACL permissions of each file. I need to compare the source file with target file and list down the difference as specified below in required output. Can someone help me on this ? Source File ************* # file: /local/test_1 # owner: own #... (4 Replies)
Discussion started by: sarathy_a35
4 Replies

2. UNIX for Beginners Questions & Answers

Reading a file line by line and print required lines based on pattern

Hi All, i want to write a shell script read below file line by line and want to exclude the lines which contains empty value for MOUNTPOINT field. i am using centos 7 Operating system. want to read below file. # cat /tmp/d5 NAME="/dev/sda" TYPE="disk" SIZE="60G" OWNER="root"... (4 Replies)
Discussion started by: balu1234
4 Replies

3. Shell Programming and Scripting

Compare file1 for matching line in file2 and print the difference in matching lines

Hello, I have two files file 1 and file 2 each having result of a query on certain database tables and need to compare for Col1 in file1 with Col3 in file2, compare Col2 with Col4 and output the value of Col1 from File1 which is a) not present in Col3 of File2 b) value of Col2 is different from... (2 Replies)
Discussion started by: RasB15
2 Replies

4. Shell Programming and Scripting

File comparision line by line

Hi, I want to compare 2 files and get output file into seperate folder. Both file names will change daily with timestamp (ex: file1_06_17_2013_0514), so i can't mention the file names in the script to compare, but i need to compare these 2 files daily and generate output to another... (28 Replies)
Discussion started by: rkrish123
28 Replies

5. Shell Programming and Scripting

Compare two CSV files and put the difference in third file with line no,field no and diff value.

I am having two csv files i need to compare these files and the output file should have the information of the differences at the field level. For Example, File 1: A,B,C,D,E,F 1,2,3,4,5,6 File 2: A,C,B,D,E,F 1,2,4,5,5,6 out put file: (12 Replies)
Discussion started by: karingulanagara
12 Replies

6. Shell Programming and Scripting

perl: comparision of field line by line in two files

Hi everybody, First I apologize if my question seems demasiad you silly, but it really took 4 days struggling with this, I looked at books, forums ... And Also ask help to a friend that is software developer and he told me that it is a bad idea do it by perl... but this is my problem. I moved to... (8 Replies)
Discussion started by: Thelost
8 Replies

7. Shell Programming and Scripting

how to read the contents of two files line by line and compare the line by line?

Hi All, I'm trying to figure out which are the trusted-ips and which are not using a script file.. I have a file named 'ip-list.txt' which contains some ip addresses and another file named 'trusted-ip-list.txt' which also contains some ip addresses. I want to read a line from... (4 Replies)
Discussion started by: mjavalkar
4 Replies

8. Shell Programming and Scripting

Print the different line from two files in unix

Hi all, I have a two files ... the first file contain "ls -la " output on directory. second file contains " ls -la " output on the same directory but after removing some files from the directory.... how to get the file names that are removed ....... the total no of files are more than 1000 so... (2 Replies)
Discussion started by: firestar
2 Replies

9. Shell Programming and Scripting

Columns comparision of two large size files and printing the difference

Hi Experts, My requirement is to compare the second field/column in two files, if the second column is same in both the files then compare the first field. If the first is not matching then print the first and second fields of both the files. first file (a .txt) < 1210018971FF0000,... (6 Replies)
Discussion started by: krao
6 Replies

10. Shell Programming and Scripting

file comparision by line

i have two files and i want to compare these two it shoud print those lines which are not in 2nd file a.txt 1236,AB,0 2345,CD,1 5679,EF,1 9123,AA,1 9223,AA,0 b.txt 1234,AB,0 2345,CD,1 5678,EF,1 9123,AA,0 o/p 1236,AB,0 5679,EF,1 9123,AA,1 9223,AA,0 (6 Replies)
Discussion started by: aaysa123
6 Replies
Login or Register to Ask a Question