Hi Guys,

I have been fighting with this project for a number of weeks now and have reached the point that I need to ask for some help from those who know more than I.

I am capturing a stream of data from a PBX splitting it into substrings and saving this to a database in specific columns which all works great except for one small problem. The PBX seems to send a signal to keep the socket alive when there is no data (ie no calls being made) and this adds a character (or more) to the start of the next string of data.

If I save the data to a text file this shows up as a "^@" at the beginning of the line of text. The number of these "^@" characters will vary based on the length of time between calls etc. What I need to know is how best do I filter my data stream to eliminate these characters? The data stream will start with a blank space followed by the days date, as in mm/dd or " 08/07" for the 7th August.

All characters after that fall in specific locations in the string so once I can find the start i.e. the 08/07 then if I can remove anything before that I will have my data... I just can't figure out how to do this!

This will need to work ongoing so using a specific number or date will not work. Also the data may be old so I can not compare the date to today's date either as a starting point. Any suggestions are greatfully accepted. If the current code would be helpful I can post it, didn't want to put too much info here to start with.

Thanks

P.S. Thought an example of the text file output might be helpful:

08/07 03:53P 00:00:46 130 9 4295794 08/07 03:56P 00:01:35 T001 001 ^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@ 08/07 04:13P 00:00:04 + 08/07 04:13P 00:00:02 T001 001

In reply to String manipulation by bajangerry

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.