in reply to Changing string in specific line/position in a file

Here's one way to go to the specified location in each chunk. (NOTE: fetching and replacement are done to end-of-line, since one field is short.)

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