Sponsored Content
Top Forums Shell Programming and Scripting Perl script to compare two files Post 302452858 by durden_tyler on Monday 13th of September 2010 08:49:10 AM
Old 09-13-2010
Quote:
Originally Posted by dinesh.4126
... instead of prinintg I want to store the diff. in a outputfile ...
...
The code snippet in your post about the meaning of "unless" had the print command to print to an output file. Have a look at that.
Also check the Perl documentation for the "print" function.

tyler_durden
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

compare 2 coloum of 2 diff files using perl script

Hi, i am new to perl scripting.. i am still learing it.. i am asked to write a perl script which should compare 2 coloums of 2 different files. if those 2 coloumn are same the script should store the both the lines in 2 diff files. these are files, file 1: 21767016 226112 char 19136520... (3 Replies)
Discussion started by: vasuki
3 Replies

2. UNIX for Dummies Questions & Answers

Compare 2 csv files in perl

need to compare 2 csv files and report should containg number of matching lines,different lines ,missing lines in one file using perl. I dont want to use read line by line and scan thru the second file for matching line ,as this logic was so time consuming .Any ideas.i need the soultion badly .... (2 Replies)
Discussion started by: kittu1979
2 Replies

3. UNIX for Dummies Questions & Answers

How to compare csv files using perl

I need to compare 2 csv files and report should containg number of matching lines,different lines ,missing lines in one file using perl. I dont want to use read line by line and scan thru the second file for matching line ,as this logic was so time consuming .Can other ideas .please respond asap... (2 Replies)
Discussion started by: kittu1979
2 Replies

4. Shell Programming and Scripting

Use Perl In Bash Script To Compare Floationg Points

Is there a way to compare two floating points numbers in a bash script using perl? I've tried just using a bash if statement and it doesn't seem to support floating point numbers. Can the perl line read vars from bash then output a var to bash? a=1.1 #from bash b=1.5 #from bash if... (3 Replies)
Discussion started by: Grizzly
3 Replies

5. Shell Programming and Scripting

Perl Script to compare between two baseline in UCM

Hello guys, I have written a script which will differentiate between two baseline in UCM: The two baseline is passed as an argument from command line. Now i can see the output in a .txt file,where it will give you the ouput in this way..... ... (2 Replies)
Discussion started by: suvenduperl
2 Replies

6. Shell Programming and Scripting

Compare two files and set a third one using awk or perl

Folks I need your help cuz I've a file with 100,000 records that need to be compared against a passwd file (300) and then create a third one with the data in the first one and the passwd from the second one set in it. The format of the first file is: host xxxxxx "" 0,0 Closed control00/... (4 Replies)
Discussion started by: ranrodrig
4 Replies

7. Shell Programming and Scripting

Need Perl script to compare two CSV files

Need perl script to compare the two CSV files and and give out put in CSV format File MsPMTP.csv File ProfileNames.csv MsPMTP.csv is having lines like below JBL_VIJ_A_A962/r01sr4sl12/port#01-#13-Au4P-4c-TMi-PMNETR15 JBL_VIJ_A_A962/r01sr4sl12/port#01-#13-Au4P-4c-TMi-PMFETR15... (9 Replies)
Discussion started by: sreedhargouda
9 Replies

8. Shell Programming and Scripting

Perl: compare columns of two files

Hi I have file 1 like this: file 2 is like this: The files are tab separated. I want to search for the first column values of file 1 in the first column of file 2 and merge the 3rd column value of file 2 to the corresponding line on first file. so the desired output is; I tried following... (2 Replies)
Discussion started by: polsum
2 Replies

9. Shell Programming and Scripting

Compare intervals (columns) from two files (awk, grep, Perl?)

Hi dear users, I need to compare numeric columns in two files. These files have the following structure. K.txt (4 columns) A001 chr21 9805831 9846011 A002 chr21 9806202 9846263 A003 chr21 9887188 9988593 A003 chr21 9887188 ... (2 Replies)
Discussion started by: jcvivar
2 Replies

10. Shell Programming and Scripting

perl Compare zone files in directory with what is listed in named.conf

I would really appreciate any assistance that I can get here. I am fairly new to perl. I am trying to rewrite my shell scripts to perl. Currently I have a shell script (using sed, awk, grep, etc) that gets a list of all of the zone files in a directory and then looks in named.conf for what... (0 Replies)
Discussion started by: brianjb
0 Replies
DIFF3(1)							     GNU Tools								  DIFF3(1)

NAME
diff3 - find differences between three files SYNOPSIS
diff3 [options] mine older yours DESCRIPTION
The diff3 command compares three files and outputs descriptions of their differences. The files to compare are mine, older, and yours. At most one of these three file names may be -, which tells diff3 to read the standard input for that file. Options Below is a summary of all of the options that GNU diff3 accepts. Multiple single letter options (unless they take an argument) can be com- bined into a single command line argument. -a Treat all files as text and compare them line-by-line, even if they do not appear to be text. -A Incorporate all changes from older to yours into mine, surrounding all conflicts with bracket lines. -B Old behavior of -A. Shows non-conflicts. -e Generate an ed script that incorporates all the changes from older to yours into mine. -E Like -e, except bracket lines from overlapping changes' first and third files. With -e, an overlapping change looks like this: <<<<<<< mine lines from mine ======= lines from yours >>>>>>> yours --ed Generate an ed script that incorporates all the changes from older to yours into mine. --easy-only Like -e, except output only the nonoverlapping changes. -i Generate w and q commands at the end of the ed script for System V compatibility. This option must be combined with one of the -AeExX3 options, and may not be combined with -m. --initial-tab Output a tab rather than two spaces before the text of a line in normal format. This causes the alignment of tabs in the line to look normal. -L label --label=label Use the label label for the brackets output by the -A, -E and -X options. This option may be given up to three times, one for each input file. The default labels are the names of the input files. Thus diff3 -L X -L Y -L Z -m A B C acts like diff3 -m A B C , except that the output looks like it came from files named X, Y and Z rather than from files named A, B and C. -m --merge Apply the edit script to the first file and send the result to standard output. Unlike piping the output from diff3 to ed, this works even for binary files and incomplete lines. -A is assumed if no edit script option is specified. --overlap-only Like -e, except output only the overlapping changes. --show-all Incorporate all unmerged changes from older to yours into mine, surrounding all overlapping changes with bracket lines. --show-overlap Like -e, except bracket lines from overlapping changes' first and third files. -T Output a tab rather than two spaces before the text of a line in normal format. This causes the alignment of tabs in the line to look normal. --text Treat all files as text and compare them line-by-line, even if they do not appear to be text. -v --version Output the version number of diff3. -x Like -e, except output only the overlapping changes. -X Like -E, except output only the overlapping changes. In other words, like -x, except bracket changes as in -E. -3 Like -e, except output only the nonoverlapping changes. SEE ALSO
cmp(1), comm(1), diff(1), ed(1), patch(1), sdiff(1). DIAGNOSTICS
An exit status of 0 means diff3 was successful, 1 means some conflicts were found, and 2 means trouble. GNU Tools 22sep1993 DIFF3(1)
All times are GMT -4. The time now is 09:41 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy