I was recently given the task of combing through 16,000 + files looking for those that were created by one employee. The only flag (since this is a Win95 peer/peer network we're talking about)(yeah, I know, but it pays the rent . . .:-), is the employee number buried in the file. The file is delimited by the character "³" (\xB3). The employee number in this case is 400. Here's the code I used:
#!/usr/bin/perl -w { $bucket = 0; $count = 1; open (LOGFILE, ">>log.txt") || die "Can't open file: $!"; while ($infile = glob("/biz/employee/data/*")) { open (INFILE, $infile) || die "Can't open file: $!"; while (<INFILE>) { print "$count : "; if ($_ =~ /³400³/) { $bucket++; print "Found Employee $bucket times.\n"; print LOGFILE ("$_\n"); } else { print "\n"; } $count++; } } print "Finished. Found Employee $bucket time in $count files. \n"; }
I know it's more of a "mundane use for Perl", but it was my first truly fuctional Perl script, and using it I was able to hand my boss the list he wanted in a day instead of longer. As far as I'm concerned, that's cool. Simplicus.

In reply to Snooping through files by Simplicus

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.