in reply to Re^4: Pre-process csv files before using
in thread Pre-process csv files before using
Could you please wrap your column header info inside code tags? Long lines don't wrap otherwise. Thanks!
#!/usr/bin/perl use strict; use warnings; my $str = <DATA>; my @origcols = split /,/,$str; my @cols = (); foreach (@origcols) { $_ =~ s/\.//g; push ( @cols , $_ ) unless /Bandwidth.*|MSTCPLoop.*/ ; } map {print $_,$/ } @cols; __DATA__ PDHCSV40EasternDaylightTime.240,ERWW.COMMUNITIES.MemoryPagesPER.sec,ER +WWCOMMUNITIESNetwor kInterfaceEthernetAdapterModuleBytesTotalPERsec,ERWWCOMMUNITIESNetwork +InterfaceEthernetAd apterCurrentBandwidth
Output
PDHCSV40EasternDaylightTime240 ERWWCOMMUNITIESMemoryPagesPERsec ERWWCOMMUNITIESNetworkInterfaceEthernetAdapterModuleBytesTotalPERsec
as you could see the periods are gone and no warnings. Also the column with bandwidth is not listd. Can you make sure your origcols array is correctly populated?
-SK
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: Pre-process csv files before using
by DrAxeman (Scribe) on Aug 06, 2005 at 21:46 UTC | |
by sk (Curate) on Aug 06, 2005 at 23:20 UTC | |
by DrAxeman (Scribe) on Aug 07, 2005 at 02:00 UTC | |
by DrAxeman (Scribe) on Aug 07, 2005 at 02:44 UTC | |
by sk (Curate) on Aug 07, 2005 at 03:47 UTC |