Reputation: 73
I have a long text file like:
COMPONENT;SCALAR;VALUE
point1/point2 - Value Value Value
point1/point2 - Value Value Value
point1/point2 - Value Value Value
point1/point2 - Value Value Value
point1/point2 - Value Value Value
point1/point2 - Value Value Value
point1/point2 - Value Value Value
COMPONENT;SCALAR;VALUE
point3/point4 - Value Value Value
point3/point4 - Value Value Value
point3/point4 - Value Value Value
point3/point4 - Value Value Value
point3/point4 - Value Value Value
point3/point4 - Value Value Value
point3/point4 - Value Value Value
Now I have already extracted all the unique values of 'point3/point4' type of values .. Now what I have to do is to extract the whole data chunk .. e.g From COMPONENT;SCALAR ----> \n\n (There are two new lines at end of block). Now what I tried to do is
string =~ /(COMPO\S\spoint1\/point2)(.+?)(COMP)/s;
print $2;
but it doesn't work. The match should match only till the first '\n\n' and not be greedy to capture max. Any one liner would be greatly appreciated.
Upvotes: 1
Views: 82