in reply to Re: How to Remove Commas ?
in thread How to Remove Commas ?
ramlight,
Thanks for your post! I'm having the best success with your suggestion, some others caused perl to crash. :(
I pasted the snippet into my script ...
# while not eof # ============= while ($line = <INPUT>) { ($date, $time, $ampm, $filesize, $filename) = split(" ", $line); # remove commas from $filesize string # =================================== $filesize =~ s/,//;
and it successfully removed the first comma. (below)
Results from gnome-terminal:
1572,727,014 IN11-135.E01 1223 IN11-135.E01.txt 1572,694,696 IN11-135.E02 1572,740,428 IN11-135.E03 1572,785,002 IN11-135.E04 1572,696,748 IN11-135.E05 1572,745,871 IN11-135.E06 1572,737,726 IN11-135.E07 1572,785,459 IN11-135.E08 1572,777,135 IN11-135.E09 1572,751,922 IN11-135.E10 1572,684,462 IN11-135.E11 1556,456,660 IN11-135.E12 Total Files: 13 Avg Size: 0
The first comma was removed from each number. Now I'm off to perldoc.perl.org to see how I can remove the remaining commas.
Thanks ... Allen.
In Section
Seekers of Perl Wisdom