how to mark a certain line in a multiline data record?
Posted on 2011-03-25
I need to mark the start of a line with a # sign following the above line with the name of the Operating System in a multiline data record.
What I don't want is to put a #sign on any lines if a line contains any number lines following the above line of the Operating System.
For example, this data record contains a number line so no # sign is needed.
The problem with my code below is that it puts a # sign even if the line following the Operating line contains a number line.
For example, the code below puts a #sign even when the data record contains a number line
my $os = '(?:windows|linux|mac)';
$_ =~ s/(^\@[^\n]*)(.*?)(^$os[^\n]*)(.*?)(^[a-zA-Z][^\n]*$)(.*?)/$1$2$3$4#$5$6/ms;