Re: [SQL] CSV import

2003-01-31 Thread Jean-Luc Lachance
In DOS and Windows, text lines end with CRLF. In Unix, text lines end with LF only. hex decoct CR=CTRL-M or 0x0D or 13 or 015 LF=CTRL-J or 0x0A or 10 or 012 Chad Thompson wrote: Unix EOL is LF not CR. Is this the only difference between a dos and unix text

Re: [SQL] CSV import

2003-01-31 Thread Guy Fraser
FYI In text files on a Mac. the EOL character is a CR only. What a messy thing this whole EOL cruft is. To convert between these text formats on linux is easy if you have dos2unix. The dos2unix on linux can perform many format conversions to and from unix,dos and mac formats. On BSD you need

Re: [SQL] CSV import

2003-01-30 Thread Chad Thompson
Unix EOL is LF not CR. Is this the only difference between a dos and unix text file? Thanks Chad ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/users-lounge/docs/faq.html

Re: [SQL] CSV import

2003-01-30 Thread Oliver Vecernik
Chad Thompson schrieb: Unix EOL is LF not CR. Is this the only difference between a dos and unix text file? Yes, but to be more precise: dos: CR + LF unix: LF mac: CR Oliver -- VECERNIK Datenerfassungssysteme A-2560 Hernstein, Hofkogelgasse 17 Tel.: +43 2633 47530, Fax: DW 50

Re: [SQL] CSV import

2003-01-29 Thread Gary Stainburn
On Wednesday 29 January 2003 5:50 am, Oliver Vecernik wrote: Oliver Vecernik schrieb: Hi again! After investigating a little bit further my CSV import couldn't work because of following reasons: 1. CSV files are delimited with CR/LF 2. text fields are surrounded by double quotes

[SQL] CSV import

2003-01-28 Thread Oliver Vecernik
Hi again! After investigating a little bit further my CSV import couldn't work because of following reasons: 1. CSV files are delimited with CR/LF 2. text fields are surrounded by double quotes Is there a direct way to import such files into PostgreSQL? I would like to have something like

Re: [SQL] CSV import

2003-01-28 Thread Achilleus Mantzios
On Tue, 28 Jan 2003, Oliver Vecernik wrote: Hi again! After investigating a little bit further my CSV import couldn't work because of following reasons: 1. CSV files are delimited with CR/LF See below 2. text fields are surrounded by double quotes in vi :1,$ s///g Is there a direct

Re: [SQL] CSV import

2003-01-28 Thread Guy Fraser
Hi You will need two text utilities {dos2unix and sed} to do this in the simplest way. They are fairly standard text utilities and are probably already on your machine. This is how I would do it : sed s/\//g file_name.txt \ | dos2unix \ | pgsql -c COPY table_name FROM STDIN USING DELIMITERS

Re: [SQL] CSV import

2003-01-28 Thread Jeff Eckermann
--- Oliver Vecernik [EMAIL PROTECTED] wrote: Is there a direct way to import such files into PostgreSQL? As I believe others have replied: no, not yet. If you are absolutely sure that your data will _never_ contain commas, then the simple solution of just deleting all of the quotes , then

Re: [SQL] CSV import

2003-01-28 Thread Jean-Luc Lachance
You can acheive the same result with: tr -d '\015' file_name.txt | psql {etc...} Unix EOL is LF not CR. Guy Fraser wrote: Hi You will need two text utilities {dos2unix and sed} to do this in the simplest way. They are fairly standard text utilities and are probably already on your

Re: [SQL] CSV import

2003-01-28 Thread Rodger Donaldson
--- Oliver Vecernik [EMAIL PROTECTED] wrote: Is there a direct way to import such files into PostgreSQL? As I believe others have replied: no, not yet. Otherwise, parsing CSV files gets just too complicated, and you are better off using an existing solution (like a Perl module) to

Re: [SQL] CSV import

2003-01-28 Thread Oliver Vecernik
Oliver Vecernik schrieb: Hi again! After investigating a little bit further my CSV import couldn't work because of following reasons: 1. CSV files are delimited with CR/LF 2. text fields are surrounded by double quotes Is there a direct way to import such files into PostgreSQL? The answer