Search Postgresql Archives

Re: Need help for import of text file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 ).


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux