logfiles - Regex to extract content from each line of a log file output from '_m' to the end of the line -
format of log line:
xxx x xx:xx:xx xmmxxx xxxxxx: xxxxxxx:xxx: xxx_mxxx_xxxxxx_mxxxxxmmxx [xxx xxxx.
i want extract '_m'
end of line, removing '_'
before 'm'
.
new regex...
thanks!
if tool/language support look-behind, works: match first _m
till eol
. ignore leading _
(?<=_)m.*
test grep:
kent$ echo "xxx x xx:xx:xx xmmxxx xxxxxx: xxxxxxx:xxx: xxx_mxxx_xxxxxx_mxxxxxmmxx [xxx xxxx."|grep -po '(?<=_)m.*' mxxxxxmmxx [xxx xxxx.
Comments
Post a Comment