in reply to $/ find a line

perl -i.orig -pe 'if ($c) { s/^line(\d+)/name$1/ } $c = /^\$\$\$\$$/; +' input.txt
Boris

Replies are listed 'Best First'.
Re^2: $/ find a line
by Anonymous Monk on Aug 10, 2004 at 11:46 UTC
    rather prefer it in a script version! but i guess this is not
    while (<IN>) { $c = /^\$\$\$\$$/; if ($c) { s/^line(\d+)/name$1/ } }
      Nearly, it is: keep in mind, that you get backupfiles as filename.orig.
      BEGIN { $^I = ".orig"; } while (defined($_ = <ARGV>)) { if ($c) { s/^line(\d+)/name$1/; } $c = /^\$\$\$\$$/; print $_; }
      Boris