I don't understand this: "The problem is to identify the number in the file because I cannot open the file because sometimes files are too large.". Maybe you are trying to read the whole file into memory at once? Open the file and read it line by line. Use a regex to modify the number, perhaps something as simple as this:
use strict; use warnings; my $n = 'asdfklj fuyy23 1234567890123456 78vc'; $n =~ s/(\d{6,6})(\d{6,6})(\d{4,4})/$1******$3/; print "$1 $2 $3\n"; print $n; __END__ 123456 789012 3456 asdfklj fuyy23 123456******3456 78vc

In reply to Re: Find Credit Card Numbers and Mask only 6 digits in a logfile by Marshall
in thread Find Credit Card Numbers and Mask only 6 digits in a logfile by gtk

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.