I have an log file that I need to extract specific patterns from. I need to find and then process them into a new file. grep on Linux would usually do the trick but the regular expression spans multiple lines, which I understand grep does not do.
here is an example from my log/debug file:
Da:
1.328 0.5045
Db:
0.6415 0.1192
Lambda:
0.4429 -0.35
-0.0461 -0.02421
seps:
0.714272
I'm looking for /Lambda:\n([-\d\.]+)\s+([\-\d\.]+)\s+\n([\-\d\.]+)\s+([\-\d\.]+)/
I then want to output the lines to a new file removing the lambda and rearrange the numbers onto the same line so output \1\s\2\s\3\s\4\n
So I have actually two questions:
- Is there an easy utility to accomplish this, on any system?
- Is there a way to do this specifically on windows?
I'm hoping there is a simple solution to this that has escaped me. I would rather stay in windows but if I have to go to Linux I will to get this done.