Hi,
I have an input file with about 330 lines in it.
The input file is created as a result of this script.
script1
========
#!/usr/local/bin/perl
open(IPF, "/home/dc5/uniq.txt"
;
open(OPF, ">> /home/dc5/uniqout.txt"
;
while(<IPF>) { $buffer .= $_}
close IPF;
$buffer =~ s/(.*?)\n(.*?)\n/$1 $2/gs;
print OPF "$buffer"
The input file (uniqout.txt) looks like
-------------------
after 51 inserted XXX3 989
inserted 989 after 510 9898
changed 76 moved to kjkj4 09090
......................
......................
total 330 lines .
i have opened another file in append mode with the following code.
script2
=======
#!/usr/local/bin/perl
open(INP , "/home/dc5/loc/uniqout.txt"
;
open(ONP , ">>/home/dc5/uniqout_filter.txt"
;
while(<INP>)
{
$i = $_;
@arr = split(/ /, $i);
if ( $#arr eq 3) { print ONP "$arr[0] $arr[1] $arr[2] $arr[3]"; }
if ( $#arr eq 4) { print ONP "$arr[0] $arr[1] $arr[2] $arr[4]"; }
if ( $#arr eq 5) { print ONP "$arr[0] $arr[1] $arr[2] $arr[5]";}
}
close INP;
close ONP;
If i execute script2 as a separate perl script it is able to print all the
330 lines with my requirement of four words per line in the output ( OPF) file uniqout_filter.txt
But .. if i take the same code (script2) and execute it along with (script1)in a single perl script it is giving only 256 lines in the (OPF file) uniq_filter.txt instead of 330.
combined script (script1 script2)
=======================================================
#!/usr/local/bin/perl
open(IPF, "/home/dc5/uniq.txt"
;
open(OPF, ">> /home/dc5/uniqout.txt"
;
while(<IPF>) { $buffer .= $_}
close IPF;
$buffer =~ s/(.*?)\n(.*?)\n/$1 $2/gs;
print OPF "$buffer"
open(INP , "/home/dc5/loc/uniqout.txt"
;
open(ONP , ">>/home/dc5/uniqout_filter.txt"
;
while(<INP>)
{
$i = $_;
@arr = split(/ /, $i);
if ( $#arr eq 3) { print ONP "$arr[0] $arr[1] $arr[2] $arr[3]"; }
if ( $#arr eq 4) { print ONP "$arr[0] $arr[1] $arr[2] $arr[4]"; }
if ( $#arr eq 5) { print ONP "$arr[0] $arr[1] $arr[2] $arr[5]";}
}
close INP;
close ONP;
==========================================================
I am confused as to what the problem may be.
please let me know where the problem is.
Thanks for the patience
Rao
I have an input file with about 330 lines in it.
The input file is created as a result of this script.
script1
========
#!/usr/local/bin/perl
open(IPF, "/home/dc5/uniq.txt"
open(OPF, ">> /home/dc5/uniqout.txt"
while(<IPF>) { $buffer .= $_}
close IPF;
$buffer =~ s/(.*?)\n(.*?)\n/$1 $2/gs;
print OPF "$buffer"
The input file (uniqout.txt) looks like
-------------------
after 51 inserted XXX3 989
inserted 989 after 510 9898
changed 76 moved to kjkj4 09090
......................
......................
total 330 lines .
i have opened another file in append mode with the following code.
script2
=======
#!/usr/local/bin/perl
open(INP , "/home/dc5/loc/uniqout.txt"
open(ONP , ">>/home/dc5/uniqout_filter.txt"
while(<INP>)
{
$i = $_;
@arr = split(/ /, $i);
if ( $#arr eq 3) { print ONP "$arr[0] $arr[1] $arr[2] $arr[3]"; }
if ( $#arr eq 4) { print ONP "$arr[0] $arr[1] $arr[2] $arr[4]"; }
if ( $#arr eq 5) { print ONP "$arr[0] $arr[1] $arr[2] $arr[5]";}
}
close INP;
close ONP;
If i execute script2 as a separate perl script it is able to print all the
330 lines with my requirement of four words per line in the output ( OPF) file uniqout_filter.txt
But .. if i take the same code (script2) and execute it along with (script1)in a single perl script it is giving only 256 lines in the (OPF file) uniq_filter.txt instead of 330.
combined script (script1 script2)
=======================================================
#!/usr/local/bin/perl
open(IPF, "/home/dc5/uniq.txt"
open(OPF, ">> /home/dc5/uniqout.txt"
while(<IPF>) { $buffer .= $_}
close IPF;
$buffer =~ s/(.*?)\n(.*?)\n/$1 $2/gs;
print OPF "$buffer"
open(INP , "/home/dc5/loc/uniqout.txt"
open(ONP , ">>/home/dc5/uniqout_filter.txt"
while(<INP>)
{
$i = $_;
@arr = split(/ /, $i);
if ( $#arr eq 3) { print ONP "$arr[0] $arr[1] $arr[2] $arr[3]"; }
if ( $#arr eq 4) { print ONP "$arr[0] $arr[1] $arr[2] $arr[4]"; }
if ( $#arr eq 5) { print ONP "$arr[0] $arr[1] $arr[2] $arr[5]";}
}
close INP;
close ONP;
==========================================================
I am confused as to what the problem may be.
please let me know where the problem is.
Thanks for the patience
Rao