Sponsored Content
Top Forums Shell Programming and Scripting Diff Command to return the number of lines inserted,deleted and changed. Post 302355102 by nmattam on Monday 21st of September 2009 12:56:25 PM
Old 09-21-2009
Java Diff to retrieve the number of lines

Thanks jim mcnamara for the help. I am new to unix. My actuall requirement is:
I have two versions of directories OLD and LATEST. I need to compare the files in both the versions and list the files that differ in both the veresions. Also i need to list the differences in the number of lines in each different files from the two versions.
Ex:
OLD has files a.txt, b.txt
LATEST has a.txt, b.txt

After Comparison a.txt is similar in both OLD and LATEST. b.txt is modified in LATEST so when diff is done, it is compared and the output should result in the number of lines as discussed above.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Output number of rows inserted, updated...

Hi all, I am new to Unix. I have written pl/sql script to be run in Unix. I have used Merge statement and subsequently would like to know the number of rows updated or inserted. Any suggestions in this regard would be great Thanks in advance Kushal (0 Replies)
Discussion started by: kushal_cog
0 Replies

2. Shell Programming and Scripting

number of lines returned from a grep command

hi all, from a shell (ksh) script, i am doing a 'grep'. how do i find out the number of lines returned from that 'grep' command ?? thanks in advance. (4 Replies)
Discussion started by: cesarNZ
4 Replies

3. Shell Programming and Scripting

Show entire lines with diff command

Hi, When I run the diff command using diff -yt file1 file2, I get the output in which original lines are truncated. I tried using -W switch with diff. However, that does not produce exact output as I want. Is it possible to show entire line of file1 and file2 in diff command's output? ... (8 Replies)
Discussion started by: jal_capri
8 Replies

4. Solaris

Grep command to return all the lines from one matched pattern to another.

For example a log file looks like below- 13:30:00- abcdefghijklhjghjghjhskj. abcdefghijkl. 14:15:00- abcdefghijkl. 14:30:00- abcdefghijkl. 14:35:00- abcdefghijkl. 123456789. 123456789. 14:45:00- abcdefghijkl. (0 Replies)
Discussion started by: dev_shivv
0 Replies

5. Shell Programming and Scripting

Grep command to return all the lines between one matched pattern to another.

14:15:00- abcdefghijkl. 14:30:00- abcdefghijkl. 14:35:00- abcdefghijkl. 123456789. 123456789. 14:45:00- abcdefghijkl. 14:50:00- abcdefghijkl. 123456789. 15:30:00-abcdefghijkl. (3 Replies)
Discussion started by: dev_shivv
3 Replies

6. UNIX for Dummies Questions & Answers

Command to split the files based on the number of lines in it

Hello Friends, Can anyone help me for the below requirement. I am having a file called Input.txt. My requirement is first check the count that is wc -l input.txt If the result of the wc -l Input.txt is less than 10 then don't split the Input.txt file. Where as if Input.txt >= 10 the split... (12 Replies)
Discussion started by: malaya kumar
12 Replies

7. Shell Programming and Scripting

Diff command file entries in different lines

Hello, I have two files to compare these contain some contents like this : FIle 1 : A B C E File 2 has some new entries and the old entries are in some different ordre File 2 could be like this : C E A B G I (4 Replies)
Discussion started by: ajayram
4 Replies

8. Shell Programming and Scripting

Get the changed field number

HI, I have two files and contains many Fields or columns with | (pipe) delimitor, wanted to compare both the files and get only unmatched perticular fields number. ex: first.txt 111 |abc| 230| hbc | bb2 | cs second.txt 111 |abc |230 |abn | bb2 | fp Here the different data in two... (2 Replies)
Discussion started by: prawinmca
2 Replies

9. Shell Programming and Scripting

Changed Field Number

HI, I have two files and contains many Fields or columns with | (pipe) delimitor, wanted to compare both the files and get only unmatched perticular fields number. ex: first.txt 1 | 2 | 3 111 |abc| 230 hbc | bb2 | cs second.txt 1 | 2 | 3 111 |abc |230 abn | bb2 | fp Here the... (7 Replies)
Discussion started by: prawinmca
7 Replies

10. Shell Programming and Scripting

awk command to return only field with a number in it

What is an awk command to print only fields with a number in it?? Input file....... S,S,S,S,S,S,S,S,S 001S,S,S,S,S,S,S,S,S 00219S,23S,24S,43S,47S,S,S,S,S 00319S,10S,23S,41S,43S,47S,S,S,S 00423S,41S,43S,46S,47S,S,S,S,S 00510S,23S,24S,43S,46S,S,S,S,S 00610S,23S,43S,46S,47S,S,S,S,S... (2 Replies)
Discussion started by: garethsays
2 Replies
DIFF(1) 						      General Commands Manual							   DIFF(1)

NAME
diff - print differences between two files SYNOPSIS
diff [-c | -e | -C n] [-br]file1 file2 OPTIONS
-C n Produce output that contains n lines of context -b Ignore white space when comparing -c Produce output that contains three lines of context -e Produce an ed-script to convert file1 into file2 -r Apply diff recursively to files and directories of EXAMPLES
diff file1 file2 # Print differences between 2 files diff -C 0 file1 file2 # Same as above diff -C 3 file1 file2 # Output three lines of context with every diff -c file1 file2 # Same diff /etc /dev # Compares recursively the directories /etc and /dev diff passwd /etc # Compares ./passwd to /etc/passwd DESCRIPTION
the same name, when file1 and file2 are both directories" difference encountered" Diff compares two files and generates a list of lines telling how the two files differ. Lines may not be longer than 128 characters. If the two arguments on the command line are both directories, diff recursively steps through all subdirectories comparing files of the same name. If a file name is found only in one directory, a diagnostic message is written to stdout. A file that is of either block special, character special or FIFO special type, cannot be compared to any other file. On the other hand, if there is one directory and one file given on the command line, diff tries to compare the file with the same name as file in the directory directory. SEE ALSO
cdiff(1), cmp(1), comm(1), patch(1). DIFF(1)
All times are GMT -4. The time now is 02:39 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy