in reply to insert line in between two lines
undef $/; open(IN, "< 1.txt") ; $str = <IN>; close(IN); $str =~ s#\n(.+?)\n#\n\$exec \= \$ENV\{EXEC\}\n$1\n#gsi; open(OUT, "> 2.txt") ; print OUT $str; input: ********* hai this is the test input sample output: ********** hai $exec = $ENV{EXEC} this is $exec = $ENV{EXEC} the test $exec = $ENV{EXEC} input sample
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: insert line in between two lines
by Anonymous Monk on Mar 16, 2005 at 12:17 UTC | |
by prasadbabu (Prior) on Mar 16, 2005 at 12:22 UTC |