Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

Not completely sure what 'literal lines" should mean to me, but ....

#!/usr/bin/perl -w use strict; use warnings; use File::stat; use lib "c:/strawberry/perl/site/lib"; #This program will extract the header information in 10K and 10Q filin +gs #as well as file sizes. #Specify the directory containing the files that you want to read; #my $files_dir = 'C:\Rick Francis\Data\SEC Filings\Filing Doc'; my $files_dir = 'E:\research\audit fee models\filings\Test'; #Specify the directory containing the results/output; #my $write_dir = 'C:\Rick Francis\Data\SEC Filings\Header Data\Revised +\DataTest.txt'; my $write_dir = 'E:\research\audit fee models\filings\filenames\filen +ames.txt'; #Open the directory containing the files you plan to read; opendir(my $dir_handle, $files_dir) or die "Can't open directory $!"; #Initialize file counter variable; my $file_count = 0; #Loop for reading each file in the input directory; while (my $filename = readdir($dir_handle)) { next unless -f $files_dir.'/'.$filename; print "Processing $filename\n"; #Initialize the variable names. my $line_count=0; my $access_num=-99; my $cik=-99; my $form_type=""; my $form=""; my $report_date=-99; my $file_date=-99; my $name=""; #my $sic=-99; #my $sic1=-99; my $file_name=""; my $htm=""; my $url=""; my $slash='/'; #Open the input file; open my $FH_IN, '<',$files_dir.'/'.$filename or die "Can't open $filen +ame"; #Within the file loop, read each line of the current file; while (my $line = <$FH_IN>) { next unless -f $files_dir.'/'.$filename; if ($line_count > 500000) { last;} #The following steps obtain basic data from various lines in the file; if($line=~m/^\s*ACCESSION\s*NUMBER:\s*/m){$access_num=$1; $access_nu +m =~ tr/-//d;}

In reply to Re^6: REGEX omit dashes - simple but ... by wrkrbeee
in thread REGEX omit dashes - simple but ... by wrkrbeee

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (3)
As of 2023-12-08 16:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?











    Results (36 votes). Check out past polls.

    Notices?