S
Stephen Moon
I have a file containing the following data. How would you use
regular expression to match the record from the header before the next
header.
G11: AD113167 #beginnning of header
Freq Mag
----------------------------------
0.00000 0.0002430974787725
0.01987 0.0002434897808872
...
G22: AD113168 #start of next header
Freq Mag
----------------------------------
0.09934 0.0000005524295687
0.11921 0.0000005192898866
0.13908 0.0000003088175192
...
G33: AD113169
...
$header =~ s/\A(.*?: \w+\s*)//
$record =~ s/\s*(.*?)\s+(\S+)/$1,$2/
I used the above for the header and the data.
It seems like '.' doesn't match new lines and '^' and '$' only works
for
a string.
Thanks in advance.
-Steve
regular expression to match the record from the header before the next
header.
G11: AD113167 #beginnning of header
Freq Mag
----------------------------------
0.00000 0.0002430974787725
0.01987 0.0002434897808872
...
G22: AD113168 #start of next header
Freq Mag
----------------------------------
0.09934 0.0000005524295687
0.11921 0.0000005192898866
0.13908 0.0000003088175192
...
G33: AD113169
...
$header =~ s/\A(.*?: \w+\s*)//
$record =~ s/\s*(.*?)\s+(\S+)/$1,$2/
I used the above for the header and the data.
It seems like '.' doesn't match new lines and '^' and '$' only works
for
a string.
Thanks in advance.
-Steve