in reply to Re^3: to copy certain content in file & repeat it .
in thread to copy certain content in file & repeat it .
i want to actuaaly print the given para in between here using these script i am print @ end of file.use warnings; use strict; my $fg=0; my $i=0; open(FF ,"lib"); open (FF1,>lib1"); while(<FF>) { my $lin =$_; print FF1 $lin; if ($lin=~m/pattern to be patched for stat copying/) { $fg=1; } if ($fg) { $lin=$_; my @arr =$lin[$i]; $i++; } if($lin=~m/pattern where to stop copying & repeating/) { $fg=0; } } if ($fg==0) { for (my $j=0;$j<$i;$j++) { print FF1 @arr[$j]; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: to copy certain content in file & repeat it .
by Anonymous Monk on Jul 01, 2011 at 10:02 UTC | |
by harshmane (Initiate) on Jul 01, 2011 at 10:55 UTC | |
by Anonymous Monk on Jul 01, 2011 at 11:20 UTC |