august3 has asked for the wisdom of the Perl Monks concerning the following question:
my $usage = "usage: get_cqa_status.pl <cqa_file_path>"; my $cqapath = ""; my $status_line = ""; ############################################ if ($#ARGV <0) { die "$usage"; } $cqapath = $ARGV[0]; my @cqafiles = glob("$cqapath/cqa_*"); open (FILE, "> $cqapath/CQA_STATUS")||die "can't open file $cqapat +h/CQA_STATUS for writing.\n"; foreach my $item (@cqafiles) { my @stats = grep ('CQA_STATUS', $item); $status_line = $stats[0]; #Remove everything before the first comma #$status_line = substr($status_line, (index $status_line, ',')+1); print FILE "$status_line\n"; } close(FILE) || die "can't close$cqapath/CQA_STATUS after writing\ +n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: extract a single line from multiple files in a folder.
by codeacrobat (Chaplain) on Mar 22, 2006 at 19:42 UTC | |
|
Re: extract a single line from multiple files in a folder.
by davido (Cardinal) on Mar 22, 2006 at 19:37 UTC | |
|
Re: extract a single line from multiple files in a folder.
by CountOrlok (Friar) on Mar 22, 2006 at 19:19 UTC | |
|
Re: extract a single line from multiple files in a folder.
by GrandFather (Saint) on Mar 22, 2006 at 19:32 UTC | |
|
Re: extract a single line from multiple files in a folder.
by bfdi533 (Friar) on Mar 22, 2006 at 21:21 UTC | |
|
Re: extract a single line from multiple files in a folder.
by graff (Chancellor) on Mar 23, 2006 at 05:13 UTC |