I want ask you for some tips. My code looks like next few rows:
#!/usr/bin/env perl
while (<DATA>) {
if (/\bSTART\b/ .. /\bEND\b/) {
#$together = $_;
#$together = chomp ($_);
print ($_, "\n");
}
}
__DATA__
rubish
rub
START Data Data Data start 15.05.2015 Data i want end Data
END
rubishend
*****************
example:
START new line 1 line 2new line 3 END
*****************
My goal is to filter many line log. Output is one or two lines matching regex. But output can be one-line --> It´s what I want. Or two-line, in this case I need to join second line to the end of first. Output from my code looks like:
START Data Data Data start 15.05.2015 Data i want end Data
END
START new line 1 line 2new line 3 END
What I want is:
START Data Data Data start 15.05.2015 Data i want end Data END
START new line 1 line 2new line 3 END
Any tips how to distinguish two line output and connect it into one line? For better parsing in next steps? Thanks for answer
From flip-flop operator's documentation:
So,
Without the flip-flop operator: