Scripting question, new problem
ms
devicerandom at gmail.com
Sat Dec 11 12:14:59 UTC 2010
On 11/12/10 02:44, Patton Echols wrote:
> I'm still working on my script to import data into gmail from a
> proprietary database. Most is working ok. The work flow is to export
> from the database to a csv flat file, then run the script to extract the
> data and reformat to a new CSV that gmail can swallow. (An absurd
> amount of googling spent on that!)
>
> Current problem is the export a subset of the database records have, for
> "street address" a two line entry like this:
>
> 123 main street
> Apartment A
>
> When that is exported, it adds a carriage return to the CSV file.
>
> What I'd like to do is have the script walk through the file, and if
> there is a line without 13 fields, combine it with the next line.
>
> Since all the date is strings, and quoted, the alternative would be to
> find a line that does not start with a literal " and "backspace" once.
>
> Can anyone suggest where to start?
>
> (By the way, yes I could manually fix the file. But the intention is to
> make this a process that can be repeated weekly, sort of like a one way
> sync.)
In Python is trivial -and surely it is also in Perl or Ruby. In what
language are you doing the script?
Perhaps better to ask to the language mailing list.
cheers,
m.
--
Massimo Sandal, Ph.D.
http://devicerandom.org
More information about the ubuntu-users
mailing list