I have a log file (of snmp traps) that should have all the info on one single line, however some pieces of the trap (varbinds) contain newlines that make the data hard to interpret. I was thinking I could strip all newlines and then insert an new one at the date, since the date string indicates a new entry, however the junk with newlines is so verbose that I need to discard it, for it makes the line exceed the buffer I am working with. I will try to insert a sample here - The junk that looks like MIME encoded data is the culprit, with the newlines, traps without this junk are all on one line, but vary in format....
09:59:58 09/28/07 1 192.168.0.7 1.3.6.1.2.1.1.3.0 TimeTick 335604562 1.3.6.1.6.3.1.1.4.1.0 OID 1.3.6.1.4.1.9.9.383.0.1 1.3.6.1.4.1.9.9.383.1.1.1 Counter64 1119125906 1.3.6.1.4.1.9.9.383.1.1.2 String 07d7091c09361400 1.3.6.1.4.1.9.9.383.1.2.14 String
AC4AMAAAAFcAaQBuAGQAbwB3AHMAIAAyADAAMAAwACAATABBAE4AIABNAGEA
bgBhAGcAZQByAAAAAAAAOP9TTUJ1AAAAAJgHyAAAAAAAAAAAAAAAAAIg//4B
MMCNB/8AOAABAP8BAAD/AQAABwBJUEMAAAAAAAAAh/9TTUKiAAAAAJgHyAAA
AAAAAAAAAAAAAAIgNA8BMACOKv8AhwAADcABAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAACAAAAAABAAAAAAAAAAAAAAAAAAAAIA/wUAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAmwESAJsBEgAAAA== 1.3.6.1.4.1.9.9 String aQBuAGQAbwB3AHMAIAAyADAAMAAyACAANQAuADEAAAAAAAAAAE7/U01CdQAF
AAAYB8gAAAAAAAAAAAAAAAAAAP/+ATDAjQT/AE4ACAABACMAAFwAXABWAEUA
TgBTAE4AQQBcAEkAUABDACQAAAA/Pz8/PwAAAABk/1NNQqIAAAAAGAfIAAAA
AAAAAAAAAAAAAiA0DwEwAI4Y/wDe3gAOABYAAAAAAAAAnwECAAAAAAAAAAAA
AAAAAAMAAAABAAAAQABAAAIAAAABEQAAXABzAHIAdgBzAHYAYwAAAAAAAIj/
U01CLwAAAAAYB8gAAAAAAAAAAAAAAAACIP/+ATBAjg== 1.3.6.1.4.1.9.9.383.1.2.16 String 192.168.20.60:3089 1.3.6.1.4.1.9.9.383.1.2.17 String osIdSource="unknown" osRelevance="relevant" osType="unknown" 192.168.0.23:139
09:59:58 09/28/07 1 192.168.0.7 1.3.6.1.2.1.1.3.0 TimeTick 335604562 1.3.6.1.6.3.1.1.4.1.0 OID 1.3.6.1.4.1.9.9.383.0.1 1.3.6.1.4.1.9.9.383.1.1.1
Ideas how to rid those offending lines (in bold - bold has newlines, the rest doesn't - sorry for the format) and reattach the latter part of the trap to the beginning ? I was thinking I could discard lines with really long words (not sure how to do that), but reattaching the remainder to the prefix, I can't get my hands around.
Thanks
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.