From: | Rémi Cura <remi(dot)cura(at)gmail(dot)com> |
---|---|
To: | Willy-Bas Loos <willybas(at)gmail(dot)com> |
Cc: | "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: importing a messy text file |
Date: | 2014-04-30 09:06:19 |
Message-ID: | CAJvUf_tbjAe_du3n8-tUcup2i4kn4oVNZCx05UsA8fpN8bs+TQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hey,
with latest version 9.3 you can use a copy from with a programm as argument.
I had a similar problem (an extra space at the end of each line), so I used
sed in a pipeline to remove it before feeding it to database.
You can use the unix | pipe for most of the stuff.
If you have an older version you can use the mkfifo command to "trick"
postgres into believing he will copy from a file.
Cheers,
Rémi-C
2014-04-30 10:47 GMT+02:00 Willy-Bas Loos <willybas(at)gmail(dot)com>:
> Alberto, it would be hard to use sed( s/^I$// ), because there is no
> explicit NULL value and there are many NULLs in the last column.
> So i can't be sure how many tabs should be in the end of each line.
>
> Yes, Karsten, maybe scripting would be the easiest way to fix this, i
> would then probably insert this line for line. That's a possibility. It
> might take a long time to run, but that's not much of an issue.
>
> --
> Willy-Bas Loos
>
From | Date | Subject | |
---|---|---|---|
Next Message | Willy-Bas Loos | 2014-04-30 09:41:42 | Re: importing a messy text file |
Previous Message | Alberto Cabello Sánchez | 2014-04-30 09:03:41 | Re: importing a messy text file |