Diffeerences files


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Diffeerences files
# 1  
Old 09-07-2007
Diffeerences files

Hi,
I have two files and and when comparing getting lot of differences ,I would like to know sample 5 comparison records with column names

dff -iw file1 file2 --It will gives the not matching records but If not matching records are very huge ,i need sample 5 records which not matching with column names.Please anyhelp.

Ex:
file 1
col1 col2 col3 col4
xx xx1 xxx2 xxx4
-- ---- ---- ---
--- ---- --- ---

File 2

col11 col22 col33 col44
yy yyy yy2 yy3

--- --- --- ---
--- -- --- ---
Thanks,
Mohan
Login or Register to Ask a Question

Previous Thread | Next Thread

9 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

Automate splitting of files , scp files as each split completes and combine files on target server

i use the split command to split a one terabyte backup file into 10 chunks of 100 GB each. The files are split one after the other. While the files is being split, I will like to scp the files one after the other as soon as the previous one completes, from server A to Server B. Then on server B ,... (2 Replies)
Discussion started by: malaika
2 Replies

3. Shell Programming and Scripting

Shell script for field wise record count for different Files .csv files

Hi, Very good wishes to all! Please help to provide the shell script for generating the record counts in filed wise from the .csv file My question: Source file: Field1 Field2 Field3 abc 12f sLm 1234 hjd 12d Hyd 34 Chn My target file should generate the .csv file with the... (14 Replies)
Discussion started by: Kirands
14 Replies

4. Shell Programming and Scripting

Append string to all the files inside a directory excluding subdirectories and .zip files

Hii, Could someone help me to append string to the starting of all the filenames inside a directory but it should exclude .zip files and subdirectories. Eg. file1: test1.log file2: test2.log file3 test.zip After running the script file1: string_test1.log file2: string_test2.log file3:... (4 Replies)
Discussion started by: Ravi Kishore
4 Replies

5. Shell Programming and Scripting

How to create zip/gz/tar files for if the files are older than particular days in UNIX or Linux?

I need a script file for backup (zip or tar or gz) of old log files in our unix server (causing the space problem). Could you please help me to create the zip or gz files for each log files in current directory and sub-directories also? I found one command which is to create gz file for the... (4 Replies)
Discussion started by: Mallikgm
4 Replies

6. Shell Programming and Scripting

need a shell script to extract the files from source file and check whether those files existonserve

Hi, I am new to shell scripting.Please help me on this.I am using solaris 10 OS and shell i am using is # echo $0 -sh My requirement is i have source file say makefile.I need to extract files with extensions (.c |.cxx |.h |.hxx |.sc) from the makefile.after doing so i need to check whether... (13 Replies)
Discussion started by: muraliinfy04
13 Replies

7. UNIX for Dummies Questions & Answers

write a program in c in unix that display the files(includ sub-direc and files within) in a sorted

the sorting is based on name of file, file size modification time stamps o f file it should dislay the output in the following format "." and ".." enteries should be ignored please give some idea how to do it (1 Reply)
Discussion started by: pappu kumar jha
1 Replies

8. Shell Programming and Scripting

How to extract data from indexed files (ISAM files) maintained in an unix server.

Hi, Could someone please assist on a quick way of How to extract data from indexed files (ISAM files) maintained in an UNIX(AIX) server.The file data needs to be extracted in flat text file or CSV or excel format . Usually we have programs in microfocus COBOL to extract data, but would like... (2 Replies)
Discussion started by: devina
2 Replies

9. Shell Programming and Scripting

How to retrieve all the linked script files/ctl files/sql files?

Hi I am going to migrate our datawarehouse system from HP Tru 64 Unix to the Red Hat Linux. Inside the box, it is running around 40 cron jobs; inside each cron job, it is calling other shell script files, and the shell script files may again call other shell script files or ctl files(for... (1 Reply)
Discussion started by: franksubramania
1 Replies
Login or Register to Ask a Question
diff(1) 						      General Commands Manual							   diff(1)

Name
       diff - differential file comparator

Syntax
       diff [options] dir1 dir2
       diff [options] file1 file2

Description
       The command compares the contents of files or groups of files, and lists any differences it finds. When run on regular files, and when com-
       paring text files that differ during directory comparison, tells what lines must be changed in the files  to  bring  them  into	agreement.
       Except  in rare circumstances, finds a smallest sufficient set of file differences.  If neither file1 nor file2 is a directory, then either
       can be specified as `-', in which case the standard input is used.  If file1 is a directory, then a file in that directory  whose  filename
       is the same as the filename of file2 is used and likewise if file2 is a directory.

       If  both  arguments  are directories, sorts the contents of the directories by name, and then runs the regular file algorithm on text files
       that are different.  Binary files that differ, common subdirectories, and files that appear in only one directory are listed.

Options
       The following options are used when comparing directories:

       -l	 Displays the output in long format.  Each text file is piped through to paginate it; other differences are summarized	after  all
		 text file differences are reported.

       -n	 Produces a script similar to that of -e, but in reverse order and with a count of changed lines on each insert or delete command.

       -r	 Recursively checks files in common subdirectories.

       -s	 Displays names of files that are the same.

       -Sname	 Starts a directory in the middle beginning with the specified file.

       Except for the -b, i, t, and w options, which may be given with any of the others, the following formatting options are mutually exclusive:

       -b	 Ignores trailing blanks and other strings of blanks and treats such portions as equal.

       -c	 Displays three context lines with each output line.  For backwards compatibility, -cn causes n number of context lines.

       -C n	 Displays specified number of context lines with each output line.  With -c or -C the output format is modified slightly: the out-
		 put begins with identification of the files involved and their creation dates and then each change is separated by a line with  a
		 dozen asterisks (*).  The lines removed from file1 are marked with minus sign (-); those added to file2 are marked plus sign (+).
		 Lines that are changed from one file to the other are marked in both files with an exclamation point (!).

		 Changes within n context lines of each other are grouped together in the output.  This results in output  that  is  usually  much
		 easier to interpret.

       -Dstring  Causes  to  create a merged version of file1 and file2 on the standard output.  With C preprocessor controls included, a compila-
		 tion of the result without defining string is equivalent to compiling file1, while defining string will yield file2.

       -e	 Writes output to an script.  In connection with -e, the following shell program can help maintain multiple versions  of  a  file.
		 Only  an  ancestral  file ($1) and a chain of version-to-version scripts ($2,$3,...) made by need be available.  A latest version
		 message appears on the standard output.
		  (shift; cat $*; echo '1,$p') | ed - $1
		 If you specify -e when comparing directories the result is a script for converting text files that are common to the two directo-
		 ries from their state in dir1 to their state in dir2.

       -f	 Writes the output in reverse order to a script.

       -h	 Makes	a hasty comparison.  It works only when changed portions are short and well separated, but does work on files of unlimited
		 length.

       -i	 Ignores the case of letters.  For example 'A' will compare equal to `a'.

       -t	 Expand tabs in output lines.  Normal or -c output adds character(s) to the front of each line which may affect the indentation of
		 the  original	source lines and make the output listing difficult to interpret.  This option will preserves the original indenta-
		 tion.

       -w	 Causes whitespace (blanks and tabs) to be totally ignored.  For example, `if ( a == b )' will compare equal to `if(a==b)'.

       There are several options for output format; the default output format contains lines of these forms:

	    n1 a n3,n4
	    n1,n2 d n3
	    n1,n2 c n3,n4

       These lines resemble commands to convert file1 into file2.  The numbers after the letters pertain to file2.  In fact, by exchanging `a' for
       `d' and reading backward you can tell how to convert file2 into file1.  As in identical pairs where n1 = n2 or n3 = n4 are abbreviated as a
       single number.

       Following each of these lines come all the lines that are affected in the first file flagged by a left angle bracket  (<).   Then  all  the
       lines that are affected in the second file are listed, flagged by a right angle bracket (>).

Restrictions
       Editing scripts produced under the -e or -f option have trouble creating lines consisting of a single period (.).

       When comparing directories with the -b, i, t, or w options specified, first compares the files as does, and then runs the algorithm if they
       are not equal.  If the only differences are in the blank strings, may report these as differences.

Diagnostics
       Exit status is 0 for no differences, 1 for some differences,and 2 if the specified file cannot be found.

Files
       for		   -h

       See Also
	      cc(1), cmp(1), comm(1), diff3(1), ed(1)

																	   diff(1)