in reply to Re^4: Split file, first 30 lines only
in thread Split file, first 30 lines only
Lets see if i can keep everyone happy here
Off the top of my head, and Untested, YMMV... my $line_count=0; open (my $fh , '<', $fullfile) or die 'something'; while (my $line=<$fh>) { last if $line_count > 29; ############## needed to add this dayum chomp $line; ############## needed to add this if($line=~m/^\s*CENTRAL\s*INDEX\s*KEY:\s*(\d*)/m){$cik=$1;} if($line=~m/^\s*FORM\s*TYPE:\s*(.*$)/m){$form_type=$1;} if($line=~m/^\s*CONFORMED\s*PERIOD\s*OF\s*REPORT:\s*(\d*)/m){$ +report_date=$1;} if($line=~m/^\s*FILED\s*AS\s*OF\s*DATE:\s*(\d*)/m){$file_date= +$1;} if($line=~m/^\s*COMPANY\s*CONFORMED\s*NAME:\s*(.*$)/m){$name=$ +1;} $line_count++; print "$cik, $form_type, $report_date, $file_date, $name\n"; print "$line_count,' ', $line,' '\n"; } close $fh or die 'something'; ...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: Split file, first 30 lines only
by wrkrbeee (Scribe) on Feb 27, 2017 at 23:25 UTC | |
by huck (Prior) on Feb 27, 2017 at 23:35 UTC | |
by wrkrbeee (Scribe) on Feb 27, 2017 at 23:46 UTC |