G
Gerhard M
hi,
i've to extract some informations from a logfile. The logfile has the
format:
[timestamp].[hostname].[pid]:[type] '[xml]' [some text]
e.g.
131112.dumbo.domain.tld.414:create_customer '<!xml...>..</..>'
additional info
but if the xml is to long the line will be truncated. Now there is:
131112.dumbo.domain.tld.414:create_customer
'<!xml...>.....................
the xml is not enclosured by quotes
what i need are the fields ($time,$process,$info,$xml) where xml is
either the xml enlcosured by the quotes or the line starting at the
first quote if line is truncated.
looking for an RE to match this i've not found the one closing at the
quote or at EOL:
while (<>) {
($time,$process,$info,$xml) = /^(\d+).*\.(\d+)
\w+)\s*'(.+)'/;
# this one will not match to long xml-lines
($time,$process,$info,$xml) = /^(\d+).*\.(\d+)
\w+)\s*'(.+)$/;
# this one will set $xml="[xml]' [text]"
($time,$process,$info,$xml) =
m#^(\d+).*\.(\d+)
\w+)\s*'([\w<>!&;,\.]+)#;
# not realy nice, if to include all possible chars to the pattern
($time,$process,$info,$xml) = m#^(\d+).*\.(\d+)
\w+)\s*'(.*>)#;
# does not work, [text] can also contain <>'s
($time,$process,$info,$xml) = m#^(\d+).*\.(\d+)
\w+)\s*'(.*)'?#;
# will ever match to eol
}
does anyone have an RE which will extract the xml correct?
thx
gerhard
i've to extract some informations from a logfile. The logfile has the
format:
[timestamp].[hostname].[pid]:[type] '[xml]' [some text]
e.g.
131112.dumbo.domain.tld.414:create_customer '<!xml...>..</..>'
additional info
but if the xml is to long the line will be truncated. Now there is:
131112.dumbo.domain.tld.414:create_customer
'<!xml...>.....................
the xml is not enclosured by quotes
what i need are the fields ($time,$process,$info,$xml) where xml is
either the xml enlcosured by the quotes or the line starting at the
first quote if line is truncated.
looking for an RE to match this i've not found the one closing at the
quote or at EOL:
while (<>) {
($time,$process,$info,$xml) = /^(\d+).*\.(\d+)
# this one will not match to long xml-lines
($time,$process,$info,$xml) = /^(\d+).*\.(\d+)
# this one will set $xml="[xml]' [text]"
($time,$process,$info,$xml) =
m#^(\d+).*\.(\d+)
# not realy nice, if to include all possible chars to the pattern
($time,$process,$info,$xml) = m#^(\d+).*\.(\d+)
# does not work, [text] can also contain <>'s
($time,$process,$info,$xml) = m#^(\d+).*\.(\d+)
# will ever match to eol
}
does anyone have an RE which will extract the xml correct?
thx
gerhard