| От | gnari |
|---|---|
| Тема | Re: Problems importing data from plain text file |
| Дата | |
| Msg-id | 003f01c495bf$63587450$0100000a@wp2000 обсуждение исходный текст |
| Ответ на | Problems importing data from plain text file (Mário Gamito <gamito@netual.pt>) |
| Список | pgsql-general |
From: "Mário Gamito" <gamito@netual.pt> > I have this plain text file with about 5000 lines. > Each line may have 4 or 5 fields, all delimited with a tab. > > I've made a table named t_zip_codes with 5 fields. > > When i run (in postgres command line) the command > > COPY t_zip_code FROM zip_codes.txt; > > it aborts as soon as it reaches a line with only 4 fields in the text > file, because the table t_zip_codes have 5 fields. > > How can i solve this annoyance ? by adding the 5th field where missing ? with something like: perl -pi.bak -e's/$/\t/ if tr/\t/\t/<4' zip_codes.txt should be easy with sed, as well (or just with your favorite editor) gnari
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера