#!/usr/bin/perl use strict; # https://perlmonks.org/?node_id=11147864 use warnings; @ARGV = 'd.11147864'; # FIXME for testing only, comment out for real life local $/ = "\f"; while( <> ) { if( /^ (?:.*\n){13} .{24} (.+)/x ) # line 14 col 25 grab rest of text { my $replacement = $1; # maybe more calculations here s/^ (?:.*\n){9} .{24} \K .+/$replacement/x; # line 10 col 25 replace rest } print; }