insert string after line number n

Hello,
How can I insert string after line number n? I have to insert string
after "//StartHere".
I know I could do this in awk but I already started
with Perl. I'm not asking for specific answer but an idea
or alorithm would be good starting with which functions
I can use to start.

For example I have a file that has:
....
this is a test.
And << >> another test;

(and maybe ;; // ##);
//

//StartHere
(insert strings here)
(and here)
(and here)
(and so on)
(depending how many)
.....

Thanks.
J
Jane [ Di, 09 Mai 2006 21:48 ] [ ID #1308281 ]

Re: insert string after line number n

Jane wrote:
> How can I insert string after line number n?

Please read the Perl FAQ *before* asking hundreds of people around the
world to read it to you.

$ perldoc -q insert
Found in /opt2/Perl5_8_4/lib/perl5/5.8.4/pod/perlfaq5.pod
How do I change one line in a file/delete a line in a
file/insert a line in the middle of a file/append to the
beginning of a file?


Paul Lalli
Paul Lalli [ Di, 09 Mai 2006 22:14 ] [ ID #1308282 ]

Re: insert string after line number n

Jane wrote:
> How can I insert string after line number n?
> I know I could do this in awk ...

man a2p
NAME
a2p - Awk to Perl translator
Joe Smith [ Mi, 10 Mai 2006 20:34 ] [ ID #1309840 ]
Perl » alt.perl » insert string after line number n

Vorheriges Thema: how to insert string in a string -> not tie
Nächstes Thema: script help