![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| perl -write values in a file to @array in perl | meghana | Shell Programming and Scripting | 27 | 06-07-2009 06:05 PM |
| Calling a perl script from a perl script | new2ss | Shell Programming and Scripting | 6 | 05-24-2009 06:03 PM |
| [PERL] Running unix commands within Perl Scripts | userix | Shell Programming and Scripting | 1 | 05-28-2008 07:06 PM |
| Perl: Run perl script in the current process | vino | Shell Programming and Scripting | 10 | 12-09-2005 10:45 AM |
| Replace Perl Module name in all Perl scripts | rahulrathod | Shell Programming and Scripting | 2 | 12-02-2005 01:00 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
perl help
Hi When call the below perl file comparision script , I was getting records which are having differences but not in what I am expecting Code:
$f1 = 'a';
open FILE1, "$f1" or die "Could not open file \n";
$f2= 'b';
open FILE2, "$f2" or die "Could not open file \n";
$outfile = 'diff.txt';
my @outlines;
foreach (<FILE1>) {
$y = 0;
$outer_text = $_;
seek(FILE2,0,0);
foreach (<FILE2>) {
$inner_text = $_;
if($outer_text eq $inner_text) {
$y = 1;
print "$outer_text, Match found \n";
last;
}
}
if($y != 1) {
print "$outer_text\n";
print "$inner_text\n";
push(@outlines, $outer_text);
}
}
open (OUTFILE, ">$outfile") or die "Cannot open $outfile for writing \n";
print OUTFILE @outlines;
close OUTFILE;
close FILE1;
close FILE2;
/ 0407|220001000002010 |60004|00000000000000000.0000 20080407|0000220001000018015 |260004|00000000000001679.1900 20080407|0000220001000017015 |0003|00000000000000000.9200 20080407|0000220001000018015 |260004|00000000000001679.1900 20080407|0000220001000018013 |260004|00000000000001679.1900 20080407|0000220001000018015 |260004|00000000000001679.1900 Expecting o/p line 1 < 0407|220001000002010 |60004|00000000000000000.0000|00000000000000000.0000 --- > 20080407|220001000002010 |60004|00000000000000000.0000|00000000000000000.0000 Last edited by Yogesh Sawant; 06-24-2008 at 01:38 AM.. Reason: added code tags |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|