Re: Importing lines of variable length from ASCII
От | Louis Becker |
---|---|
Тема | Re: Importing lines of variable length from ASCII |
Дата | |
Msg-id | 21A6A90E7CD2584DB72892049E1DE78F016AF25B@MAIL01.99eight.com обсуждение исходный текст |
Ответ на | Re: Importing lines of variable length from ASCII (Andrej <andrej.groups@gmail.com>) |
Ответы |
Re: Importing lines of variable length from ASCII
Re: Importing lines of variable length from ASCII |
Список | pgsql-novice |
Hi Andre Luckily have installed cygwin on my WindowsXP box, so I should be able to execute your suggested command. Is there not a way for PostGres to absorb this? I prefer not to pre-process all the time, as this would be a daily task. If I am just able to adjust the copy query, that would be preferred. Very few of my colleagues are Unix/Linux capable and most are command line phobic. If I am able to save the query/command that would be much easier. Louis -----Original Message----- From: pgsql-novice-owner@postgresql.org [mailto:pgsql-novice-owner@postgresql.org] On Behalf Of Andrej Sent: 25 February 2010 22:36 To: A. Kretschmer Cc: pgsql-novice@postgresql.org Subject: Re: [NOVICE] Importing lines of variable length from ASCII On 26 February 2010 00:52, A. Kretschmer <andreas.kretschmer@schollglas.com> wrote: > kretschmer@tux:~$ cat file.txt | awk '{cols=split($0,a,"|"); if (cols==4) print $0; else printf ("%s|\n",$0)}' Slightly shorter variant: awk -F'|' '{if(NF<4){print $0"|"}else{print $0}}' file.txt > Regards, Andreas Cheers, Andrej -- Please don't top post, and don't use HTML e-Mail :} Make your quotes concise. http://www.american.edu/econ/notes/htmlmail.htm -- Sent via pgsql-novice mailing list (pgsql-novice@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-novice DISCLAIMER This message is intended solely for the individual(s) and entity(s) to which it is addressed. It is confidential and maycontain legally privileged information. Any unauthorized review, use, copying, storage, disclosure or distribution of this e-mail and any attachments is strictlyprohibited. If you are not the named recipient or have otherwise received this communication in error, please destroy this message from your system and kindlynotify the sender by e-mail.
В списке pgsql-novice по дате отправления: