bajangerry has asked for the wisdom of the Perl Monks concerning the following question:
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: String manipulation
by moritz (Cardinal) on Aug 07, 2007 at 20:35 UTC | |
by ikegami (Patriarch) on Aug 07, 2007 at 20:41 UTC | |
by bajangerry (Sexton) on Aug 07, 2007 at 20:59 UTC | |
by bajangerry (Sexton) on Aug 07, 2007 at 23:30 UTC | |
by moritz (Cardinal) on Aug 08, 2007 at 06:58 UTC | |
|
Re: String manipulation
by toolic (Bishop) on Aug 07, 2007 at 20:27 UTC | |
by bajangerry (Sexton) on Aug 07, 2007 at 20:39 UTC | |
by GrandFather (Saint) on Aug 07, 2007 at 21:18 UTC | |
by bajangerry (Sexton) on Aug 07, 2007 at 21:49 UTC | |
by graff (Chancellor) on Aug 07, 2007 at 22:28 UTC | |
by GrandFather (Saint) on Aug 07, 2007 at 22:20 UTC |