Re: What text format is this and can I import it into Postgres?

From: Mike Christensen <mike(at)kitchenpc(dot)com>
To: John R Pierce <pierce(at)hogranch(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: What text format is this and can I import it into Postgres?
Date: 2012-08-23 02:17:16
Message-ID: CABs1bs24mGTfRy5PFNGGfm-imYcSC74TjZ67dnCKEF5rKV6EVQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Aug 22, 2012 at 5:57 PM, John R Pierce <pierce(at)hogranch(dot)com> wrote:
> On 08/22/12 5:23 PM, Mike Christensen wrote:
>>
>> I'd like to import this data into a Postgres database:
>>
>>
>> http://www.ars.usda.gov/SP2UserFiles/Place/12354500/Data/SR24/dnload/sr24.zip
>>
>> However, I'm not quite sure what format this is. It's definitely not
>> CSV. Here's an example of a few rows:
>>
>
> this worked for me... (in psql)
>
> create table test (f1 text,f2 text,f3 text,f4 text,f5 text,f6 text,f7
> text,f8 text,f9 text);
> \copy test from DATA_SRC.txt with delimiter '^' csv quote as '~'
> select * from test;
> -[ RECORD 1
> ]-----------------------------------------------------------------------------------------------------------------------
> ----------------------------------------------------------
> f1 | D1066
> f2 | G.V. Mann
> f3 | The Health and Nutritional status of Alaskan Eskimos.
> f4 | 1962
> f5 | American Journal of Clinical Nutrition
> f6 | 11
> f7 |
> f8 | 31
> f9 | 76
> -[ RECORD 2
> ]-----------------------------------------------------------------------------------------------------------------------
> ----------------------------------------------------------
> f1 | D1073
> f2 | J.P. McBride, R.A. Maclead
> f3 | Sodium and potassium in fish from the Canadian Pacific coast.
> f4 | 1956
> f5 | Journal of the American Dietetic Association
> f6 | 32
> f7 |
> f8 | 636
> f9 | 638
> -[ RECORD 3
> ]-----------------------------------------------------------------------------------------------------------------------
> ----------------------------------------------------------
> f1 | D1107
> f2 | M.E. Stansby
> f3 | Chemical Characteristics of fish caught in the northwest Pacific
> Oceans.
> f4 | 1976
> f5 | Marine Fish Rev.
> f6 | 38
> f7 | 9
> f8 | 1
> f9 | 11
> .........
>
>
>
> obviously, use better field names...

SWEET!

This is exactly what I needed. Thanks so much.. Already got the
first table imported..

Mike

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Michael Sacket 2012-08-23 02:32:32 Re: NULL value comparison
Previous Message Craig Ringer 2012-08-23 02:04:27 Re: Can column name aliases be supported?