I've created a large (~3 million rows) file. Well it's off by 22 rows from what it should be. In it's creation i exclude carriage returns and line feeds.
SELECT ... SUBSTR ( REPLACE ( REPLACE ( memo_system_txt, CHR(10), '' ), CHR(13), +'' ), 1, 255 ) AS memo_sys_txt, ...
But something is getting through. I'd like to find out what. I think it might be a tab character, but I am not sure. So I thought I'd parse through my file and see if I can find it. .... ok, this is where I need help. :) Am I on the right track?
#!/usr/bin/perl use strict; use warnings; open F, "memo.txt"; open X, ">memo.txt_error"; my $row; my $line; $row = 0; while (<F>) { chomp; $line = $_; $row++; # Look for any lines of the wrong length # if ( length $line != 2340 ) # { # printf X "%u : ||%s||\n", $row, $line; # } # Find any control characters if ( $line =~ /[[:cntrl]]/ ) { my $c = $1; printf X "%u : ||%s||\n", $row, $line; printf X "\t : ||%s||\n", ORD($c); print X "---------------------------"; } } close X; close F;
Getting:
printf() on unopened filehandle X at ./a2.pl line 20, <F> line 150.
Can't call method "ORD" without a package or object reference at ./a2.pl line 21, <F> line 150
What did I get wrong? I'd like to find the numeric value (i.e. ORD(tab) is 9) and where in the line the character is located. Thanks for your help. Eric

Edit: g0n - replaced pre tags with code tags


In reply to Searching for control characters by ericdp

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.