$ cat t1.pl #!/usr/bin/perl -p BEGIN{$i=0} s|

((?).*)

|'

'.$1.'

'|egs; $ seq 1 10 | while read; do echo '

texttexxxxx

'; done | perl t1.pl

texttexxxxx

texttexxxxx

texttexxxxx

texttexxxxx

texttexxxxx

texttexxxxx

texttexxxxx

texttexxxxx

texttexxxxx

texttexxxxx

$