Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Using perl to extract data from multiple .txt files

by blue_cowdawg (Monsignor)
on Nov 14, 2012 at 16:26 UTC ( #1003849=note: print w/ replies, xml ) Need Help??


in reply to Using perl to extract data from multiple .txt files

use strict; opendir(INDIR,"/path/to/directory/with/files") or die $!; while (my $fname = readdir(INDIR)){ next unless $fname =~ m@\.txt$@; open FIN," < $fname" or die "$fname: $!"; my @stuff=<FIN>; close FIN; #process lines.... }
There's another way of doing it.


Peter L. Berghold -- Unix Professional
Peter -at- Berghold -dot- Net; AOL IM redcowdawg Yahoo IM: blue_cowdawg


Comment on Re: Using perl to extract data from multiple .txt files
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1003849]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (8)
As of 2014-09-19 08:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (133 votes), past polls