Обсуждение: copy
Hello. We are moving a database from informix to Postgresql. To do so we do an unload from Informix and copy to postgresql. Informix unloads with a delimiter also after the last field in a record. This is no problem when doing a copy to Postgresql 7.2 You get a warning (to many fields) but the copy process continues. In 7.4 however the copy stops . Does anyone know how to proceed the copy or a fast way to remove the last character from the unload files. They are anyhow to big to handle with vi. Many thanks Henk Sanders
H.J. Sanders wrote: > Hello. > > We are moving a database from informix to Postgresql. > > To do so we do an unload from Informix and copy to postgresql. > > Informix unloads with a delimiter also after the last field in a record. > > This is no problem when doing a copy to Postgresql 7.2 > You get a warning (to many fields) but the copy process continues. > > In 7.4 however the copy stops . > > Does anyone know how to proceed the copy or a fast way to remove the last > character > from the unload files. > > They are anyhow to big to handle with vi. sed 's/.$//' file > newfile Always test before using, it's off the top of my head.. -- Until later, Geoffrey
cat <file> | sed '<delimiter>$//' > <file>.new this should remove the last delimiter ------------------( Forwarded letter 1 follows )--------------------- Date: Wed, 1 Dec 2004 13:33:26 +0100 To: pgsql-admin@postgresql.org.comp From: H.J.Sanders[hjs]@rmax.nl.comp Sender: pgsql-admin-owner+m15591@postgresql.org.comp Subject: [ADMIN] copy Hello. We are moving a database from informix to Postgresql. To do so we do an unload from Informix and copy to postgresql. Informix unloads with a delimiter also after the last field in a record. This is no problem when doing a copy to Postgresql 7.2 You get a warning (to many fields) but the copy process continues. In 7.4 however the copy stops . Does anyone know how to proceed the copy or a fast way to remove the last character from the unload files. They are anyhow to big to handle with vi. Many thanks Henk Sanders ---------------------------(end of broadcast)--------------------------- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
fat fingered that one: cat < file> | sed 's/<delimiter>$//'> <file>.new ------------------( Forwarded letter 1 follows )--------------------- Date: Wed, 1 Dec 2004 10:03:00 -0500 To: H.J.Sanders[hjs]@rmax.nl.comp Cc: pgsql-admin@postgresql.org.comp From: CHRIS.HOOVER@companiongroup.com.comp Sender: pgsql-admin-owner+m15600@postgresql.org.comp Subject: Re: [ADMIN] copy cat <file> | sed '<delimiter>$//' > <file>.new this should remove the last delimiter ------------------( Forwarded letter 1 follows )--------------------- Date: Wed, 1 Dec 2004 13:33:26 +0100 To: pgsql-admin@postgresql.org.comp From: H.J.Sanders[hjs]@rmax.nl.comp Sender: pgsql-admin-owner+m15591@postgresql.org.comp Subject: [ADMIN] copy Hello. We are moving a database from informix to Postgresql. To do so we do an unload from Informix and copy to postgresql. Informix unloads with a delimiter also after the last field in a record. This is no problem when doing a copy to Postgresql 7.2 You get a warning (to many fields) but the copy process continues. In 7.4 however the copy stops . Does anyone know how to proceed the copy or a fast way to remove the last character from the unload files. They are anyhow to big to handle with vi. Many thanks Henk Sanders ---------------------------(end of broadcast)--------------------------- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) ---------------------------(end of broadcast)--------------------------- TIP 9: the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match