I have a file that I need to modify, but would like to do so without creating a new file. There are 2 form feeds in the file that must be removed. The first is near the top of the file...always at the start of line 52. The last form feed is the only thing on the last line of the file.
I know I can truncate the file to remove the last form feed:
open (FH, "+< $file");
while ( <FH> ) {
$addr = tell(FH) unless eof(FH);
}
truncate(FH, $addr);
Is there anyway to snip out that other form feed from line 52? It is always the first character on the line. But the actual amount of data prior to the 52nd line is unknown.
I know I can truncate the file to remove the last form feed:
open (FH, "+< $file");
while ( <FH> ) {
$addr = tell(FH) unless eof(FH);
}
truncate(FH, $addr);
Is there anyway to snip out that other form feed from line 52? It is always the first character on the line. But the actual amount of data prior to the 52nd line is unknown.