03-23-2013
You're welcome.
Regards,
Alister
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hello,
I want to compare two files. All records in file 2 that are not in file 1 should be output to file 3.
For example:
file 1
123
1234
123456
file 2
123
2345
23456
file 3 should have
2345
23456
I have looked at diff, bdiff, cmp, comm, diff3 without any luck! (2 Replies)
Discussion started by: blt123
2 Replies
2. UNIX for Dummies Questions & Answers
Hello,
Can anyone let me know what is the maximum file size that can be given as input for the "Diff" Command in Unix?
I have a file size as large as 28MB and which can also increase. Will I face any issues with such a file size. If yes, What is the other alternative.
Thanks in advance for... (1 Reply)
Discussion started by: Neeraja
1 Replies
3. Shell Programming and Scripting
Okie I have two files.
file1 with input
asdf_s45
fdsa_s20
jkl_s32
lkj_s3
and file2 with input
asdf_s44
fdsa_s19
jkl_s31
lkj_s2
now I have counted the total number of lines in the file and put it in a variable so num_lines=4
now I have a while loop to repeat a diff command... (6 Replies)
Discussion started by: bigboizvince
6 Replies
4. Shell Programming and Scripting
Sorry for the duplicate thread this one is similar to the one in
https://www.unix.com/shell-programming-scripting/88132-awk-sed-script-read-values-parameter-files.html#post302255121
Since there were no responses on the parent thread since it got resolved partially i thought to open the new... (4 Replies)
Discussion started by: rajan_san
4 Replies
5. Shell Programming and Scripting
i have two file.
i want to count the lines of each file one by one in loop and compare it.
can any one pls help me on this? (1 Reply)
Discussion started by: Aditya.Gurgaon
1 Replies
6. Shell Programming and Scripting
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... (2 Replies)
Discussion started by: nmattam
2 Replies
7. Shell Programming and Scripting
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
8. Shell Programming and Scripting
Hi.. I'm facing a trouble in replacing two blank lines in a file using shell script...
I used sed to search a line and insert two blank lines after the searchd line using the following sed command.
Sed "/data/{G;G;}/" filename. In the file, after data tag, two lines got inserted blank lines.. Now... (1 Reply)
Discussion started by: arjun_arippa
1 Replies
9. Shell Programming and Scripting
Hi.. I'm facing a trouble in replacing two blank lines in a file using shell script...
I used sed to search a line and insert two blank lines after the searchd line using the following sed command.
sed "/data/{G;G;}/" filename . In the file, after data tag, two lines got inserted blank lines..... (4 Replies)
Discussion started by: arjun_arippa
4 Replies
10. Shell Programming and Scripting
Hi,
I am doing aws security group auditing every day to find the difference. I am using git to find the difference. But some times some security group rules order is changing up and down(swapping lines). So 'git diff' command gives this as a difference which i dont want(i need only new lines... (2 Replies)
Discussion started by: jobycxa
2 Replies
LEARN ABOUT LINUX
algorithm::diffold
Algorithm::DiffOld(3pm) User Contributed Perl Documentation Algorithm::DiffOld(3pm)
NAME
Algorithm::DiffOld - Compute `intelligent' differences between two files / lists but use the old (<=0.59) interface.
NOTE
This has been provided as part of the Algorithm::Diff package by Ned Konz. This particular module is ONLY for people who HAVE to have the
old interface, which uses a comparison function rather than a key generating function.
Because each of the lines in one array have to be compared with each of the lines in the other array, this does M*N comparisions. This can
be very slow. I clocked it at taking 18 times as long as the stock version of Algorithm::Diff for a 4000-line file. It will get worse
quadratically as array sizes increase.
SYNOPSIS
use Algorithm::DiffOld qw(diff LCS traverse_sequences);
@lcs = LCS( @seq1, @seq2, $comparison_function );
$lcsref = LCS( @seq1, @seq2, $comparison_function );
@diffs = diff( @seq1, @seq2, $comparison_function );
traverse_sequences( @seq1, @seq2,
{ MATCH => $callback,
DISCARD_A => $callback,
DISCARD_B => $callback,
},
$comparison_function );
COMPARISON FUNCTIONS
Each of the main routines should be passed a comparison function. If you aren't passing one in, use Algorithm::Diff instead.
These functions should return a true value when two items should compare as equal.
For instance,
@lcs = LCS( @seq1, @seq2, sub { my ($a, $b) = @_; $a eq $b } );
but if that is all you're doing with your comparison function, just use Algorithm::Diff and let it do this (this is its default).
Or:
sub someFunkyComparisonFunction
{
my ($a, $b) = @_;
$a =~ m{$b};
}
@diffs = diff( @lines, @patterns, &someFunkyComparisonFunction );
which would allow you to diff an array @lines which consists of text lines with an array @patterns which consists of regular expressions.
This is actually the reason I wrote this version -- there is no way to do this with a key generation function as in the stock
Algorithm::Diff.
perl v5.10.1 2006-07-31 Algorithm::DiffOld(3pm)