From: | "Louis Becker" <Louis(dot)Becker(at)leo(dot)na> |
---|---|
To: | "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com> |
Cc: | <pgsql-novice(at)postgresql(dot)org> |
Subject: | Re: Importing lines of variable length from ASCII |
Date: | 2010-02-26 09:06:28 |
Message-ID: | 21A6A90E7CD2584DB72892049E1DE78F016AF25B@MAIL01.99eight.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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(at)postgresql(dot)org
[mailto:pgsql-novice-owner(at)postgresql(dot)org] On Behalf Of Andrej
Sent: 25 February 2010 22:36
To: A. Kretschmer
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: [NOVICE] Importing lines of variable length from ASCII
On 26 February 2010 00:52, A. Kretschmer
<andreas(dot)kretschmer(at)schollglas(dot)com> wrote:
> kretschmer(at)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(at)postgresql(dot)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 may contain legally privileged information.
Any unauthorized review, use, copying, storage, disclosure or distribution of this e-mail and any attachments is strictly prohibited. If you are not the named
recipient or have otherwise received this communication in error, please destroy this message from your system and kindly notify the sender by e-mail.
From | Date | Subject | |
---|---|---|---|
Next Message | A. Kretschmer | 2010-02-26 09:39:44 | Re: Importing lines of variable length from ASCII |
Previous Message | Michael Wood | 2010-02-26 09:01:05 | Re: How many columns can I have in an ORDER BY clause? |