Sponsored Content
Top Forums Shell Programming and Scripting Diff Command to return the number of lines inserted,deleted and changed. Post 302354970 by nmattam on Monday 21st of September 2009 05:22:19 AM
Old 09-21-2009
Java Diff Command to return the number of lines inserted,deleted and changed.

Hello,
I have to compare two files file1 and file2, retrieve the number of lines modified (added, deleted or modified) in file2. Output must be like:

File2:
Added Deleted Changed Total
------ ------- -------- -----
2 1 1 4


Somebody please help me, Thanks in advance!!!
 

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
DIFF3(1)						      General Commands Manual							  DIFF3(1)

NAME
diff3 - 3-way differential file comparison SYNOPSIS
diff3 [ -exEX3 ] file1 file2 file3 DESCRIPTION
Diff3 compares three versions of a file, and publishes disagreeing ranges of text flagged with these codes: ==== all three files differ ====1 file1 is different ====2 file2 is different ====3 file3 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. Under the -e option, diff3 publishes a script for the editor ed that will incorporate into file1 all changes between file2 and file3, i.e. the changes that normally would be flagged ==== and ====3. Option -x (-3) produces a script to incorporate only changes flagged ==== (====3). The following command will apply the resulting script to `file1'. (cat script; echo '1,$p') | ed - file1 The -E and -X are similar to -e and -x, respectively, but treat overlapping changes (i.e., 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. For example, suppose lines 7-8 are changed in both file1 and file2. Applying the edit script generated by the command "diff3 -E file1 file2 file3" to file1 results in the file: lines 1-6 of file1 <<<<<<< file1 lines 7-8 of file1 ======= lines 7-8 of file3 >>>>>>> file3 rest of file1 The -E option is used by RCS merge(1) to insure that overlapping changes in the merged files are preserved and brought to someone's atten- tion. FILES
/tmp/d3????? /usr/libexec/diff3 SEE ALSO
diff(1) BUGS
Text lines that consist of a single `.' will defeat -e. 7th Edition October 21, 1996 DIFF3(1)
All times are GMT -4. The time now is 11:53 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy