1830210 Members
2283 Online
109999 Solutions
New Discussion

Re: diff file

 
Son dam bi
Advisor

diff file

I have two files want to be find the difference , the format is as below

file A
======
$vi fileA
file1.txt
file2.txt
file3.txt
file4.txt
"

file B
======
$vi fileB
testfile1.txt
testfile2.txt
testfile3.txt
test5.txt
"

the file B has the files but all files begins with "test" , if I use diff to find the difference , it will pop all lines are different .

Can advise if I want to ignore such kind of difference , that mean if the line in file B is begins with the "test" , then treat this is not a difference , so that the result is as below , what can i do ? thx

my desired diff result
===============
< test4.txt
---
> test5.txt
5 REPLIES 5
Yogesh M Puranik
Valued Contributor

Re: diff file

Hi Son,

Well the diff command captures minute differnces also, even a space as well as a comma.

So I dont think so you will get your required output using diff comand.

Rgds

Yogesh
Son dam bi
Advisor

Re: diff file

thx reply ,

if diff not work for me , how can I find the difference in my case ? can you adivse ? thx
Dennis Handly
Acclaimed Contributor

Re: diff file

>if I want to ignore such kind of difference, that mean if the line in file B is begins with the "test", then treat this is not a difference

You'll have to convert file B so it is the same "format" as file A:
sed -e 's/^test//' fileB > fileB.new
diff fileA fileB.new
Shiv007
Frequent Advisor

Re: diff file

Also try.

sdiff
Steven Schweda
Honored Contributor

Re: diff file

> You'll have to [do some specific thing ...]

Any statement like this is almost certainly
false. I'm still waiting to be shown the
computer problem which admits only one
solution.

> [...] what can i do ?

I have no idea what you can do. Many people
would write some kind of computer program to
solve a problem like this, but that would
probably require a more precise description
of what might possibly be in the files.