in reply to need help editing lines of a file
The only problem with that method is if your text file is over 50% of your available RAM. Then, instead of being blazingly fast, it's only moderately fast.my @lines = <>; foreach my $index (0 .. $#lines) { if ($lines[$index] =~ /word/) { # Do what you want here, but to $lines[$index - 1] } }
Originally posted as a Categorized Answer.
|
|---|