Comparing two files and list the differences


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Comparing two files and list the differences
# 8  
Old 11-30-2011
Did you try to use diff command?
Before 'diff' you may try to sort it first by 3rd word in the file.
--j
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

Comparing time differences between 2 Solaris servers

Good day to all. I'm relatively new in using the Sun Solaris OS. I would like to request your expertise in helping to solve a problem that I have at work. Not sure if this has been asked before but I have tried searching through the internet to no avail. Basically I have 2 sun solaris... (8 Replies)
Discussion started by: Fossil_84
8 Replies

3. Shell Programming and Scripting

Need to compare the two files and list out differences between the two

Hi, I need to compare the two files and list out difference between the two. Please assist. Best regards, Vishal (2 Replies)
Discussion started by: Vishal_dba
2 Replies

4. Shell Programming and Scripting

Comparing list of files

Hi All, I have a list of files and want to find the difference between each file if there is difference then i want the file name to be printed and log the duplicate files For example Size Filename 23 a1 23 a2 23 a3 45 a4 If i diff a1 and a2 and find... (3 Replies)
Discussion started by: wedng.bell
3 Replies

5. Shell Programming and Scripting

Comparing 2 xml files and print the differences only in output

Hi....I'm having 2 xml files, one is having some special characters and another is a clean xml file does not have any special characters. Now I need one audit kind of file which will show me only from which line the special characters have been removed and the special characters. Can you please... (1 Reply)
Discussion started by: Krishanu Saha
1 Replies

6. Shell Programming and Scripting

Help comparing 2 files and sending differences

I have 2 files that need to be compared. Email the differences if something is different and don't email if nothing is different. One or both of the files could be empty. One or both could have data in them. example files backup.doc.$(date +%y%m%d) file size is 0 backup.doc.$(TZ=CST+24... (4 Replies)
Discussion started by: jabbott3
4 Replies

7. Shell Programming and Scripting

Perl: Comparing to two files and displaying the differences

Hi, I'm new to perl and i have to write a perl script that will compare to log/txt files and display the differences. Unfortunately I'm not allowed to use any complied binaries or applications like diff or comm. So far i've across a code like this: use strict; use warnings; my $list1;... (2 Replies)
Discussion started by: dont_be_hasty
2 Replies

8. Shell Programming and Scripting

Differences between 2 Flat Files and process the differences

Hi Hope you are having a great weeknd !! I had a question and need your expertise for this : I have 2 files File1 & File2(of same structure) which I need to compare on some columns. I need to find the values which are there in File2 but not in File 1 and put the Differences in another file... (5 Replies)
Discussion started by: newbie_8398
5 Replies

9. Shell Programming and Scripting

Comparing files columnwise and print the differences in third file

Hello Everybody!!!!!!!!! Request you to help me with the below mentioned issue: I have 2 files say, File 1: a|4|7 b|3|2 c|8|8 d|8|9 File 2: a|4|6 b|2|2 c|8|8 d|9|8 The third file(output file) should have: Data mismatch in row 1 column 3 Data mismatch in row 2 coumn 2 Data... (3 Replies)
Discussion started by: abhijeet1409
3 Replies

10. Shell Programming and Scripting

comparing file content differences

I need to write a script to find out if there are any .c files created/removed from the last time i monitored the files available. i first created a file to contain all the .c files available on the system. (ls *.c > file1) I created another file using the same command. I used the comm file1... (4 Replies)
Discussion started by: RianTan
4 Replies
Login or Register to Ask a Question
lucompare(1M)						  System Administration Commands					     lucompare(1M)

NAME
lucompare - compare boot environments SYNOPSIS
/usr/sbin/lucompare [-i infile | -t] [-o outfile] BE_name [-X] /usr/sbin/lucompare [ -C file [-o outfile]] [-X] DESCRIPTION
The lucompare command is part of a suite of commands that make up the Live Upgrade feature of the Solaris operating environment. See live_upgrade(5) for a description of the Live Upgrade feature. The lucompare command compares the contents of the current boot environment (BE) with the contents of another BE. With the -C option, lucompare compares file statistics so that you can determine which files have changed on a BE since a specified time, such as the creation time of a BE. A specified BE must be inactive and in the complete state, as reported by the lustatus(1M) command. Also, a BE cannot have a copy job scheduled, which is also reported by lustatus(1M). A specified BE cannot have any partitions mounted with lumount(1M) or mount(1M). For each file system defined for a specified BE, lucompare compares all files with the files with the same pathnames in the current BE. The files present in the active BE, but not in the specified BE, and vice-versa, are reported. You also have the option to specify a list of files to be compared. If you specify the -C option, instead of doing an absolute comparison of the current BE with a target BE, lucompare compares the files in a specified BE with the list of files recorded in a file. When a BE is created, lucreate(1M) creates a file named :<BE_name> in /etc/lu/com- pare. You can use the -C option to compare the files in a specified BE to this snapshot in /etc/lu/compare or you can compare the BE to a file previously created with the -o option. Comparing a BE to its own snapshot in /etc/lu/compare enables you to determine which files have changed on the BE since its creation. By default, the output of lucompare is written to stdout. With the -C option, you must use the -o option to specify an output file. The output for lucompare is a list of files that differ in permissions, owner, group, or sum, along with the reason for difference. The output format is shown below: > active BE < BE_name reason > file_name:owner:group:number_of_links:mode:type: size or major_minor number:checksum < file_name:owner:group:number_of_links:mode:type: size or major_minor number:checksum The above fields are obtained from the stat(2) structure of the file. The type field can be one of the following: SYMLINK symbolic link FIFO FIFO file CHRSPC character special BLKSPC block special DIR directory REGFIL regular file UNKNOW unknown file type lucompare computes checksums only if the file on the specified BE matches its counterpart on the active BE in all of the fields described above. If the checksums differ, lucompare appends the differing checksums to the entries for the compared files. The lucompare command requires root privileges. OPTIONS
The lucompare command has the following options: -C file Compare file statistics of BE with those recorded in file. file can be the snapshot created at BE creation time, /etc/lu/compare/:<BE_name>, or a file previously created with the -o option. You must use the -o option with this option. -i infile Compare files listed in infile. The files to be compared should be an absolute filename. If the entry in the file is a directory, then comparison is recursive with respect to the directory. Mutually exclusive of -t. -o outfile Send output of differences to outfile. You must use this option if you use -C. -t Compare only nonbinary files. This is achieved by performing a file(1) command on each file in the tree walk and only comparing text files. Mutually exclusive of -i. -X Enable XML output. Characteristics of XML are defined in DTD, in /usr/share/lib/xml/dtd/lu_cli.dtd.<num>, where <num> is the version number of the DTD file. OPERANDS
BE_name Name of the BE to which the active BE will be compared. You cannot specify a BE that is involved in another Live Upgrade operation, or specify a BE for which you have mounted partitions (using lumount(1M) or mount(1M)). EXAMPLES
Example 1: Checking Differences Since BE Creation The following command lists the differences in the BE s8u5 between its creation time and the present. # lucompare -C /etc/lu/compare/:s8u5 -o /var/tmp/compare.out s8u5 Note that /etc/lu/compare/:s8u5 is the file created by lucreate upon creation of a BE. The list of differences is sent to /var/tmp/com- pare.out. EXIT STATUS
The following exit values are returned: 0 Successful completion. >0 An error occurred. FILES
/etc/lutab list of BEs on the system /usr/share/lib/xml/dtd/lu_cli.dtd.<num> Live Upgrade DTD (see -X option) ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWluu | +-----------------------------+-----------------------------+ SEE ALSO
lu(1M), luactivate(1M), lucancel(1M), lucreate(1M), lucurr(1M), ludelete(1M), ludesc(1M), lufslist(1M), lumake(1M), lumount(1M), lure- name(1M), lustatus(1M), luupgrade(1M), lutab(4), attributes(5), live_upgrade(5) NOTES
The lucompare command makes no attempt to reconcile any differences it detects between BEs. SunOS 5.10 21 Dec 2001 lucompare(1M)