Re: Need help for import of text file
От | Adrian Klaver |
---|---|
Тема | Re: Need help for import of text file |
Дата | |
Msg-id | 50CCCDC1.20804@gmail.com обсуждение исходный текст |
Ответ на | Need help for import of text file (Andreas <maps.on@gmx.net>) |
Список | pgsql-general |
On 12/15/2012 11:06 AM, Andreas wrote: > Hi, > > I need to import textfiles that have 5 columns but there is just blanks > as delimitors. > I could use COPY to read them but there is a time column that shows > times as " h:mm.ss,ms" in the morning and "hh:mm.ss,ms" in the afternoon. > > Problem here is in the morning the first digit of the hour is shown as a > blank so there are 2 blanks before the time so COPY misstakes this as an > empty column and gets confused. > > Can someone point me in the direction of an COPY option I'm not aware > of, or alternativly to some console tool that I can put in the batch > before the import step and replace the 2 blanks with 1 blank. > > I use an OpenSuse server so some linux tool would do. How big a file are we talking about? I found using the OO/LibreOffice spreadsheet good for this, assuming a reasonable file size. If you use the CSV import you can make the columns where you want them and then save the file with another delimiter(I tend to use the pipe symbol |). Then use that file with COPY. > > > regards > Andreas > > -- Adrian Klaver adrian.klaver@gmail.com
В списке pgsql-general по дате отправления: