From: | Andreas <maps(dot)on(at)gmx(dot)net> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Need help for import of text file |
Date: | 2012-12-16 17:48:35 |
Message-ID: | 50CE0973.8060003@gmx.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Am 15.12.2012 22:22, schrieb Peter Bex:
> On Sat, Dec 15, 2012 at 10:16:55PM +0100, Peter Bex wrote:
>> A simple sed(1) expression should do the trick:
>>
>> sed -E 's/ +/ /g' old-file > new-file
> I just remembered where I could check, and the GNU sed equivalent is:
>
> sed -r 's/ +/ /g' old-file > new-file
>
> Sorry for the confusion.
>
With sed as startingpoint I figured it out.
Those 3 steps make the input files consumable for COPY
1. dos2unix
2. sed -i 's/[ \t]*$//'
3. sed -i 's/ / /g'
The input files get created by a simple windows batch where I can't
change anything.
It uses echo to attach a line of 4 parameters to those textfiles.
How would you manage if one or more of those parameters contained blanks
in some cases?
This doesn't appear, yet. But I consider this as luck. :}
The real column formats are ( TEXT, TEXT, DATE, TIME ).
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2012-12-16 17:51:08 | Re: Authenticate with hash instead of plaintext password? |
Previous Message | Andres Freund | 2012-12-16 17:31:50 | Re: Default timezone changes in 9.1 |