Closed jjarava closed 8 years ago
Hi,
thanks for sharing this complex example.
${1}
and $1
are both correct, the former is just more specific and prevents problem e.g. when the variable is directly followed by a number (would $11
be submatch 1 followed by '1' or submatch 11?).
Using named submatches should work: please try to use (?P<name>pattern)
within the regular expressions. I will update the docs to make that more clear.
The --replace
parameter looks fine.
I hope this solves the problem, if it does not it would be great if you could share one (anonymized) sample log line for testing.
Hi!
I'm trying to get sift to parse quite a "rich" log file
This "incantation" works well:
And produces the output I'm expecting (yes, in the second sift, the second
-e
has only 4 capture groups, but that's the way the logs are.Now, this is quite in the limit (or beyond?) readability, and every time the log format is tweaked (and it is), it's a pain to change.
So following the reference in http://www.regular-expressions.info/named.html, I've arrived to the following:
Which doesn't match anything. I've tried using
$name
and${name}
syntax for the--replace
section, as the docs in https://sift-tool.org/docs actually are a bit confusing... The docs say:but in fact the examples use the
--replace '$1'
syntaxAnyhow I'm stuck - I don't know if what I'm trying to do is not possible (I doubt it), or where I'm making the mistake...
Thanks!