How to replace rows from...to in a file?

Here is a description what i need:

Document1:

start...
aaa
bbb
ccc
...end

=======================
Document2:

start...
<paste the copied lines here>
...end

All rows of document1 between "start...end" should be copied into the empty section "start...end" of document2.
The strings "start...end" are in all documents.

:rolleyes: Sorry for my english...Thx.

Hi,

Please find the command

awk '/^start/,/^end/' a1(Filenmae1) > a2(filename2)

example:

$more a1
start
one two
three four
end
five sixe
severn eight
start
chennai
salem
trichy
end
$awk '/^start/,/^end/' a1 > a2
$more a2
start
one two
three four
end
start
chennai
salem
trichy
end

Extract from f1 and insert in f2 and f3:

$
$ cat f1
start...
aaa
bbb
ccc
...end
$
$ cat f2
THIS IS FILE F2
start...

...end
END OF FILE F2
$
$ cat f3
THIS IS FILE F3
start...
...end
END OF FILE F3
$
$ ##
$ perl -ne 'BEGIN{undef $/; open(F1,"f1"); $str = <F1>;
>           $str =~ s/start...|\n...end//g; close(F1)}
>           s/(start...).*?(...end)/$1$str$2/msg; print' f2
THIS IS FILE F2
start...
aaa
bbb
ccc
...end
END OF FILE F2
$
$
$ perl -ne 'BEGIN{undef $/; open(F1,"f1"); $str = <F1>;
          $str =~ s/start...|\n...end//g; close(F1)}
          s/(start...).*?(...end)/$1$str$2/msg; print' f3
THIS IS FILE F3
start...
aaa
bbb
ccc
...end
END OF FILE F3
$
$

tyler_durden

Thx for reply.
I have written the code in my script file:

#!C:/perl/bin/perl -w

BEGIN {
undef $/;
open(F1,"f1.txt");
$str = <F1>;
$str =~ s/start...|\n...end//g;
close(F1)
}
s/(start...).*?(...end)/$1$str$2/msg;
print "f2.txt";

I always get the Message:
"Use of uninitialized value in substitution (s///) at C:\Test\doit.pl line 12."

Please help!