I have an input like following.
Curveplot
Time
Maxima of Curve
Part no.
13 #pts=2
* Minval= 0.000000e+000 at time= 0.000000
* Maxval= 2.237295e+000 at time= 0.001000
0.000000e+000 0.000000e+000
9.999999e-004 2.237295e+000
endcurve
I want to take get the maximum value out of this file, which is the value after Maxval
* Maxval= 2.237295e+000
Can someone suggest how to do it with linux sed ?
My output would only be the number 2.237295e+000.
Using the following one-liner will only display
2.237295e+000sed -nr 's/.*Maxval= *([^ ]*).*/\1/p'Regex:
So effectively we substitute the whole line containing the word
Maxval=by the value ofMaxval.Note: depending on the platform and/or implementation of
sedthe you may need to use-Einstead of-r.