06-03-2009
Ignore a string pattern while doing file comparison/difference
Here is my problem. I have to find the differences in 2 XML files
This is my Old File contents - File1
<FILEHDR>
<Bag xsi:nil='true'></Bag>
</FILEHDR>
This is my New File contents - File2
<FILEHDR>
<Bag xsi:nil='true' ></Bag>
</FILEHDR>
When I do the following
diff -b File1 File2
Even though I used the -b option to ignore the amount of white spaces, I get this difference, as there is an extra space after xsi:nil='true' in my new file.
How can I avoid this particular pattern xsi:nil='true' while doing difference of the files ?
Overall I wanted to figure out how can I avoid a pattern while doing comparison/difference of 2 files.
Appreciate your help
Last edited by sksahu; 06-03-2009 at 06:39 PM..
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi all,
I need help in doing this scenario. I have two files with multiple lines. I want to compare these two files but ignoring the lines which have words like Tran, Loc, Addr, Charge. Also if i have a word Credit in line, i want to tokenize (i.e string after character "
... (2 Replies)
Discussion started by: jakSun8
2 Replies
2. Shell Programming and Scripting
I want to ignore the spaces while doing string comparison between two files.
Iam using "comm" command to compare the files. (1 Reply)
Discussion started by: sudhakaryadav
1 Replies
3. Shell Programming and Scripting
Hi folks,
I'm trying to do a bit of extra monitoring on who is sending mail through our server and as I'm sure you'll understand, the log files aren't exactly small.
As a note, I'm working to sort out a solution to this myself, so I'll keep editing the post when I get a chance.
Here an example... (2 Replies)
Discussion started by: beddo
2 Replies
4. Shell Programming and Scripting
Hi,
I have a FTP script that check for ".done" files in the remote path and the "get" the corresponding data files. Here's how it does.....
First it list all the *.done file as below:
ls *.done
And then it picks one file and get the corresponding data file. After that it... (3 Replies)
Discussion started by: dips_ag
3 Replies
5. Shell Programming and Scripting
I got three different file:
Part of File 1
ARTPHDFGAA
.
.
Part of File 2
ARTGHHYESA
.
.
Part of File 3
ARTPOLYWEA
.
. (4 Replies)
Discussion started by: patrick87
4 Replies
6. Shell Programming and Scripting
Hello Guys,
I request anyone to do me a small help in using diff command for following.
I am trying to compare two files for content and wish to keep the content after the comparison (The resultant file can't be blank)
However, the first lines would be different in both files and I need diff... (2 Replies)
Discussion started by: rockf1bull
2 Replies
7. Shell Programming and Scripting
continuing from my previous post, whose link is given below as a reference
https://www.unix.com/shell-programming-scripting/171076-shell-scripting.html#post302573569
consider there is create table commands in a file for eg:
CREATE TABLE `Blahblahblah` (
`id` int(11) NOT NULL... (2 Replies)
Discussion started by: vivek d r
2 Replies
8. Shell Programming and Scripting
Hi ,
I have the file where i have to search for the pattern. The pattern may be lower case or upper case or camel case. Basically I want to ignore while searching the pattern in awk.
awk '/error|warning/exception/' filename
Please help me (3 Replies)
Discussion started by: arukuku
3 Replies
9. Shell Programming and Scripting
I am trying to search a file for a patterns ERR- in a file and return a count for each of the error reported
Input file is a free flowing file without any format
example of output
ERR-00001=5
....
ERR-01010=10
.....
ERR-99999=10 (4 Replies)
Discussion started by: swayam123
4 Replies
10. Shell Programming and Scripting
I have the logic below to look up for matches within the columns between the two files with awk.
In the if statement is where the string comparison is attempted with ==
The issue seems to be with the operands, as
1. when " '${SECTOR}' " -- double quote followed by single quote -- awk matches... (1 Reply)
Discussion started by: deadyetagain
1 Replies
LEARN ABOUT REDHAT
tiffcmp
TIFFCMP(1) General Commands Manual TIFFCMP(1)
NAME
tiffcmp - compare two TIFF files
SYNOPSIS
tiffcmp [ options ] file1.tif file2.tif
DESCRIPTION
Tiffcmp compares the tags and data in two files created according to the Tagged Image File Format, Revision 6.0. The schemes used for com-
pressing data in each file are immaterial when data are compared-data are compared on a scanline-by-scanline basis after decompression.
Most directory tags are checked; notable exceptions are: GrayResponseCurve, ColorResponseCurve, and ColorMap tags. Data will not be com-
pared if any of the BitsPerSample, SamplesPerPixel, or ImageWidth values are not equal. By default, tiffcmp will terminate if it encoun-
ters any difference.
OPTIONS
-l List each byte of image data that differs between the files.
-t Ignore any differences in directory tags.
BUGS
Tags that are not recognized by the library are not compared; they may also generate spurious diagnostics.
The image data of tiled files is not compared, since the TIFFReadScanline() function is used. A error will be reported for tiled files.
The pixel and/or sample number reported in differences may be off in some exotic cases.
SEE ALSO
pal2rgb(1), tiffinfo(1), tiffcp(1), tiffmedian(1), libtiff(3)
September 26, 1994 TIFFCMP(1)