You haven't said much about what you'd like to see. Do you want simply an indication that the files are the same or different? Do you need to know details on a line-by-line basis? Can the file content be reordered?
One could look at the lengths of the files. If they differ in length, then they cannot be the same. If the length is the same, then you could use a check-summing code, say md5sum, to calculate a numeric signature for the files, and then compare all the signatures.
If you want detailed attempts from responders here, then post some representative samples of 4 files, along with how you think the output should be displayed.
I want a soultion to compare two arrays in sh with an easy way.I want a solution to synchrose users between different AIX servers where no NIS is available. All users are meant to be same on all 10 servers. So the approach is to consider first server as master user repository and whatever the users... (0 Replies)
Team,
I have two files and I am trying to find the lines unique to file1. So i have executed the below command at shell prompt and got the correct results
comm -23 <(sort test) <(sort test1)
When i run the same command in Bash shell script, i got the correct results.
But when i run... (5 Replies)
Hi,
I have a situation to compare one file, say file1.txt with a set of files in directory.The directory contains more than 100 files.
To be more precise, the requirement is to compare the first field of file1.txt with the first field in all the files in the directory.The files in the... (10 Replies)
Hi,
I need to compare two directories and I'm using the command tar -dvf directory.tar in the directory on other machine.
I saw in the result, message like Uid, Gid, Mod time differs, etc... and it is understandable
etc/group: Uid differs
etc/group: Gid differs
etc/rc2.d/K01nrpe: Mod... (2 Replies)
Hi All,
I have written the shell script which does the following :
a. Reads the *.cnf file content from the specified input folder path
b. Grep's some strings from the *.cnf file and writes the output in result file(*.cnf_result.txt) in output folder
c. Now, if we get new version of... (5 Replies)
I want to compare two files, 1) Compare Each query result. 2) Compare Only first row of the Query output 3) Compare Time (3rd column), First file time is lesser than 2nd file then print the PO_NUM else do nothing.
File1:
C:\script>call transaction 1OPOP
C:\script>Select ID, PO_ID, TIME, DES... (3 Replies)
So I have this issue. I have 4 files. the first one is the master file who has all possible combinations:
file 1
- a
- b
- c
- d
- e
the other three have some of the letters and a number instead of - for example
file 2
34 a
5 c
file 3
10 b
12 ... (3 Replies)
Hi guys, looking for some help with a way to compare data in two files but with some conditions.
example,
File 1 consists of
site1,10.1.1.1
site2,20.2.2.2
site3,30.3.3.3
File 2 contains
site1,l0.1.1.1
site2,50.1.1.1
site3,30.3.3.3
site4,40.1.1.1
I want to be able to match the... (1 Reply)
Hello,
I have two text files, each with a single column,
file 1:
124152970
123899868
123476854
54258288
123117283
file 2:
124152970
123899868
54258288
123117283
122108330 (5 Replies)
Hi,
Below are the sample files. x.txt is from an Excel file that is a list of users from Windows and y.txt is a list of database account.
$ head -500 x.txt y.txt
==> x.txt <==
TEST01 APP_USER_PROFILE
USER03 APP_USER_PROFILE
TEST02 APP_USER_EXP_PROFILE
TEST04 APP_USER_PROFILE
USER01 ... (3 Replies)
Discussion started by: newbie_01
3 Replies
LEARN ABOUT SUNOS
diff3
diff3(1) User Commands diff3(1)NAME
diff3 - 3-way differential file comparison
SYNOPSIS
diff3 [-exEX3] filename1 filename2 filename3
DESCRIPTION
diff3 compares three versions of a file, and publishes disagreeing ranges of text flagged with these codes:
==== all three files differ
====1 filename1 is different
====2 filename2 is different
====3 filename3 is different
The type of change suffered in converting a given range of a given file to some other is indicated in one of these ways:
f : n1 a Text is to be appended after line number n1 in file f, where f = 1, 2, or 3.
f : n1 , n2 c Text is to be changed in the range line n1 to line n2. If n1 = n2, the range may be abbreviated to n1.
The original contents of the range follows immediately after a c indication. When the contents of two files are identical, the contents of
the lower-numbered file is suppressed.
The following command will apply the resulting script to filename1.
(cat script; echo '1,$p') | ed - filename1
OPTIONS -e Produce a script for the ed(1) editor that will incorporate into filename1 all changes between filename2 and filename3 (that is,
the changes that normally would be flagged ==== and ====3).
-x Produce a script to incorporate only changes flagged ====.
-3 Produce a script to incorporate only changes flagged ====3.
-E Produce a script that will incorporate all changes between filename2 and filename3, but treat overlapping changes (that is,
changes that would be flagged with ==== in the normal listing) differently. The overlapping lines from both files will be inserted
by the edit script, bracketed by <<<<<< and >>>>>> lines.
-X Produce a script that will incorporate only changes flagged ====, but treat these changes in the manner of the -E option.
USAGE
See largefile(5) for the description of the behavior of diff3 when encountering files greater than or equal to 2 Gbyte ( 2**31 bytes).
FILES
/tmp/d3*
/usr/lib/diff3prog
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
|Availability |SUNWesu |
|CSI |enabled |
+-----------------------------+-----------------------------+
SEE ALSO diff(1), attributes(5), largefile(5)NOTES
Text lines that consist of a single `.' will defeat -e.
Files longer than 64 Kbytes will not work.
SunOS 5.10 14 Sep 1992 diff3(1)