Hi monks, i have a file that i need to parse, this file comes from the output of a DSLAM command.

When i open the file i find some weird chars (-^[[1D\^[[1D|^[[1D/^) on it, that i need to remove in order to better parse the file

this is the part of the file that has the special chars:
configure qos profiles cac FD_ONTUniVideo res-voice-bandwidth 0 max-mc +ast-bandwidth 24000 res-data-bandwidth 0 configure qos profiles marker d1p marker_hsi default-dot1p 2 configure qos profiles marker d1p FD_Marker_BE default-dot1p 0 configure qos profiles marker d1p FD_Marker_CL default-dot1p 3 configure qos profiles marker d1p FD_Marker_Voice default-dot1p 6 -^[[1D\^[[1D|^[[1D/^[[1D-^[[1D\^[[1D|^[[1D/^[[1D-^[[1D\^[[1D|^[[1D/^[[ +1D-^[[1D\^[[1D|^[[1D/^[[1D-^[[1D\^[[1D|^[[1D/^[[1D-^[[1D\^[[1D|^[[1D/ +^[[1D-^[[1D\^[[1D|^[[1D/^[[1D-^[[1D\^[[1D|^[[1D/^[[1D-^[[1D\^[[1D|^[[ +1D/^[[1D-^[[1D\^[[1D|^[[1D/^[[1D-^[[1D\^[[1D|^[[1D/^[[1D-^[[1D\^[[1D| +^[[1D/^[[1D-^[[1D\^[[1D|^[[1D/^[[1D-^[[1D\^[[1D|^[[1D/^[[1D-^[[1D\^[[ +1D|^[[1D/^[[1D-^[[1D\^[[1D|^[[1D/^[[1D-^[[1D\^[[1D|^[[1D/^[[1D-^[[1D\ +^[[1D|^[[1D/^[[1D-^[[1D\^[[1D|^[[1D/^[[1D-^[[1D\^[[1D|^[[1D/^[[1D-^[[ +1D\^[[1D|^[[1D/^[[1D-^[[1D\^[[1D|^[[1D/^[[1D-^[[1D\^[[1D|^[[1D/^[[1D- +^[[1D\^[[1D|^[[1D/^[[1D-^[[1D\^[[1D|^[[1D/^[[1D ^[[1Dconfigure qos pr +ofiles policer Flash1d committed-info-rate 640 committed-burst-size 1 +14000 configure qos profiles policer Flash1u committed-info-rate 320 committ +ed-burst-size 114000 configure qos profiles policer Flash2d committed-info-rate 928 committ +ed-burst-size 114000 configure qos profiles policer Flash2u committed-info-rate 320 committ +ed-burst-size 114000 configure qos profiles policer Flash3d committed-info-rate 1280 commit +ted-burst-size 114000 configure qos profiles policer Flash3u committed-info-rate 320 committ +ed-burst-size 114000 configure qos profiles policer Flash4d committed-info-rate 1824 commit +ted-burst-size 114000 configure qos profiles policer Flash4u committed-info-rate 320 committ +ed-burst-size 114000 configure qos profiles policer p-neg2d committed-info-rate 480 committ +ed-burst-size 114000 configure qos profiles policer p-neg2u committed-info-rate 480 committ +ed-burst-size 114000 configure qos profiles policer p-neg4d committed-info-rate 640 committ +ed-burst-size 114000 configure qos profiles policer p-neg4u committed-info-rate 640 committ +ed-burst-size 114000 configure qos profiles policer p-neg6d committed-info-rate 1824 commit +ted-burst-size 114000 configure qos profiles policer p-neg6u committed-info-rate 1824 commit +ted-burst-size 114000 configure qos profiles policer p-res2d committed-info-rate 480 committ +ed-burst-size 114000 configure qos profiles policer p-res2u committed-info-rate 480 committ +ed-burst-size 114000 configure qos profiles policer Flash_5d committed-info-rate 320 commit +ted-burst-size 114000

Now this is a snip of my perl code that parses the file and i can't seem to find a way to strip those special chars from the file

use strict; use warnings; use IO::File; my $qosProfLog = "/svn/projects/DSLAMCheck/branches/fullcheck+multipro +cess/work/qosprofile/qosprofilelist_log_ACST8H1-11283.log"; my $QOSPROFLIST_LOG_FH = IO::File->new(); $QOSPROFLIST_LOG_FH->open($qosProfLog,"r"); while (<$QOSPROFLIST_LOG_FH>) { if ( /configure qos profiles policer/ ) { chomp; tr/\040-\176//csd; print "$_\n"; } }
Thanks for your help.

In reply to Removing special chars from line by ataX

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.