Re: Fixed width COPY

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: webb sprague <wsprague(at)o1(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Fixed width COPY
Date: 2001-05-08 00:09:14
Message-ID: 24136.989280554@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

webb sprague <wsprague(at)o1(dot)com> writes:
> Does anybody know of a good way to COPY a file into a table if the data is
> based on fixed width format?

COPY insists on having delimiters; you'll need to translate the file
format into something COPY can deal with.

> Do I just have to write some code with scanf(Ick)?

If you like C, that would work, but you could doubtless accomplish the
same result with very short scripts in sed, awk, perl, tcl, or half a
dozen other text-bashing tools. Pick your poison...

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Joseph Shraibman 2001-05-08 00:58:37 Re: Auto-timestamp generator (attached)
Previous Message Bruce Momjian 2001-05-07 23:30:41 Re: 7.1-1 installation from RPM