Not sure what part you are having trouble with but try this
poj#!/usr/bin/perl use strict; use warnings; use File::stat; use Text::CSV_XS; my $csv = Text::CSV_XS->new( { binary => 1, eol => $/ } ); my $ONE_DAY = 86400; my $Foutput = "data0426-2.csv"; open my $out, ">", $Foutput or die "$!"; # create array of csv filenames in directory my $dirname = "Daily_QoS_CPD_link"; unless (-d $dirname) { die "Not able to open $dirname"; } my @dir = glob "$dirname/*.csv"; # parse files modifed in past 24 hours foreach my $infile (@dir){ my $age = time()-stat($infile)->mtime; if( $age < $ONE_DAY ){ open my $FH, "<", $infile or die "Could not open $infile : $!"; while (my $row = $csv->getline($FH)) { if ( $row->[2] =~ /^(DROPPED-10|CALL_START|CALL_END)$/ ) { $csv->print($out, $row); } } close $FH; } }
In reply to Re^3: Read Directory and getlines in .csv
by poj
in thread Read Directory and getlines in .csv
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |