Re: How to remove [], {}, and other characters, rendering numeric values in a CSV file ?
- From: rvtol+news@xxxxxxxxxxxx (Dr.Ruud)
- Date: Thu, 26 Jun 2008 23:49:03 +0200
yitzle schreef:
while ( my $line = <> ) {
$line =~ /cluster\[(\d)+\] = {([\d ]+)}/ or die;
my @vals = split( / +/, "$1 $2" );
print join(",", @vals) . "\n";
}
Less strict alternative:
while (<>) {
my @vals = /([0-9]+)/g or die;
print join(",", @vals) . "\n";
}
or even:
{ local ($\, $,) = ("\n", ",");
print /([0-9]+)/g while <>;
}
--
Affijn, Ruud
"Gewoon is een tijger."
.
- References:
- Prev by Date: Re: How to remove [], {}, and other characters, rendering numeric values in a CSV file ?
- Next by Date: Check if directory is empty on Win32
- Previous by thread: Re: How to remove [], {}, and other characters, rendering numeric values in a CSV file ?
- Next by thread: Re: How to remove [], {}, and other characters, rendering numeric values in a CSV file ?
- Index(es):