 |
|
Home:
Perl Programming Help:
Beginner:
Re: [KevinR] extract data...:
Edit Log
|
|

AWHF
Novice
Jun 25, 2007, 6:34 PM
Views: 2630
|
|
Re: [KevinR] extract data...
|
|
|
sorry! what i'm trying to mean that is i want to open all the files in a directory which the name ended by .doc. let's say the file called "file1.doc", "file2.doc", "file3.doc", .... and the directory called "document". i had try out this script but it could not function. there is nothing in the "result" #!/usr/bin/perl my $dirname = "/eng/png/home/awhf/document"; chdir ($dirname) || die "can't chdir to $dirname: $!"; opendir(DIR, $dirname) || die "can't open directory: $!"; my @files = grep {/\.doc$/} readdir DIR; close DIR; open(OUT, ">>/eng/png/home/awhf/result") || die "can't open: $!"; while (<@files>) { s/\s*(\w+).*/$1/; if (/^::start/../^end/) { print OUT; } } close OUT
(This post was edited by AWHF on Jun 25, 2007, 6:40 PM)
|
|
|
Edit Log:
|
|
Post edited by AWHF
(Novice) on Jun 25, 2007, 6:39 PM
|
|
Post edited by AWHF
(Novice) on Jun 25, 2007, 6:40 PM
|
|
|  |