How to remove trailing commas and points from a CSV file ?
- From: perez.erasmo@xxxxxxxxx (Erasmo Perez)
- Date: Thu, 26 Jun 2008 11:26:17 -0500
Hi dear list:
Please forgive my lack of Perl credentials, but i am a complete beginner
But, and that is the problem, I do have an urgent issue and that's why
I came to perl in the very first instance
I have a CSV file, which comes in the following format:
a,b,.,.,.,.,.,.,.
b,c,d,.,.,.,.,.,.
e,f,g,h,.,.,.,.,.
i,j,k,l,m,.,.,.,.
and so on
My problem: how could I get rid of the trailing points and commas, so
the output CSV file could get following neat format (without the
trailing points and its commas separators):
a,b
b,c,d
e,f,g,h
i,j,k,l,m
I mean, the points repressent missing values in the original CSV,
which are separated by commas
Once the points start to appear in the line, the line does not hold
any not-missing value, I mean, after a points starts, there will be
only points (and their commas separators) till the end of the line
If a perl program could detect a point, in a line, the logic of the
solution could be to make a Return to the next line, forgetting the
rest of the previous line.
How could I manage that operation with perl ?
Thank you very much for your help
Regards
Erasmo
.
- Follow-Ups:
- Re: How to remove trailing commas and points from a CSV file ?
- From: John W. Krahn
- Re: How to remove trailing commas and points from a CSV file ?
- From: Jeff Peng
- Re: How to remove trailing commas and points from a CSV file ?
- Prev by Date: Re: parsing a tree like structure
- Next by Date: No Dialog Boxes working
- Previous by thread: not able to install Digest::SHA
- Next by thread: Re: How to remove trailing commas and points from a CSV file ?
- Index(es):
Relevant Pages
|