hello,
this maybe silly to ask, worse if asked by a level 5 monk who needs only 75 points up to level 6, but I cannot solve my problem, so...
here's the plain question:
I often use a keylogger, please don't ask why, how and where, but what really matters is that its log looks similar to this:
------cuthere------------
hee{BS}llo, I'll be bnack{BS}{BS}{BS}{BS}ack next saturday.
{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}www.yahoo.com
"keyloggers" + "linux"
{BS}{BS}{BS}
-----cuthere---------------

and so on.
I wanted to write a perlscript to get rid of all those {BS} and substitute them with real backspaces, so that I could see what was REALLY written.
so I tried this:

#!/usr/bin/perl -w use strict; my $output; $output = $ARGV[0].".clean"; open (INF, "< $ARGV[0]"); open (OUF, "> $output"); while (<INF>) { s/{BS}/\b/g; } print OUF $riga; close (INF); close (OUF);
but it fills the log with 0x08 characters instead of backspacing over the previous character. useless.
so I thought of this regexp:

s/.{BS}//g

but it didn't work and I couldn't figure out why.
then I did: after having found the first occurrence of .{BS} it deletes it and falls on the following "{" starting to search again, and finds the next one this way:

{BS}{BS} | ------- this is current position {BS}{BS} ---- this is what it finds! {BS}{BS} ----- and this is what it deletes, leaving me with a {BS{BS

and so on.

the real question is:
how can i tell to perl that it must start searching each time FROM THE BEGINNING and not from the last position, so to be sure that each backspace is converted into a REAL backspace?
thanks, SiG

In reply to Cleaning the Log by Sigmund

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.