CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Intermediate:
blank columns in csv



Aug 2, 2008, 6:39 AM

Post #1 of 3 (945 views)
blank columns in csv Can't Post

Is there a way to find out which columns are blank in a csv file?

I've a file with 100s of rows and 80 odd columns...

i need to remove the blank columns and remove them ....


Aug 8, 2008, 12:02 PM

Post #2 of 3 (892 views)
Re: [raghunand] blank columns in csv [In reply to] Can't Post

a blank csv column should consist of two comma's next to each other with 0 or more spaces, so if you replace anything which matches that pattern (something like /,\s*,/ ) and replace it with a single comma, the blank will go away (shift the rest left).

The major concern is if you have blanks in some rows which don't correspond to an entire column, then you'd also remove those as well and shift the row left. You could try running over the entire file once and have the program learn which columns are blank by checking the placement of blanks between rows.

Hopefully that gives you some idea of how to proceed


Aug 19, 2008, 12:01 AM

Post #3 of 3 (847 views)
Re: [raghunand] blank columns in csv [In reply to] Can't Post

I don't think raghunand is checking the post, but just in case, it is worth mentioning that there are many modules on CPAN for dealing with .csv files.
The more you teach me, the more I learn. The more I learn, the more I teach.


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives