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

From: John R Pierce <pierce(at)hogranch(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: What text format is this and can I import it into Postgres?
Date: 2012-08-23 00:57:21
Message-ID: 50357FF1.70504@hogranch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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...

--
john r pierce N 37, W 122
santa cruz ca mid-left coast

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message John R Pierce 2012-08-23 00:58:19 Re: What text format is this and can I import it into Postgres?
Previous Message Jeff Janes 2012-08-23 00:56:27 Re: Alternatives to very large tables with many performance-killing indicies?