Обсуждение: Copy from text file
Hi, It is possible to copy data from text file (CSV) ignoring some columns of this text file? Thanks, Ricardo Vaz Tribunal de Contas do Estado de São Paulo Diretoria de Tecnologia jrvaz@tce.sp.gov.br -- Esta mensagem foi verificada pelo sistema de antivírus e acredita-se estar livre de perigo.
Ricardo Vaz wrote: > Hi, > > > It is possible to copy data from text file (CSV) ignoring some columns > of this text file? (How come this was posted 3 times?) I don't think so but you could load it into a temporary table and then: insert into new_table select col1, col2 from temp_table; -- Postgresql & php tutorials http://www.designmagick.com/
Chris wrote: > Ricardo Vaz wrote: >> Hi, >> >> >> It is possible to copy data from text file (CSV) ignoring some columns >> of this text file? Assuming you're on a Unix box, you could easily use awk or perl to parse your csv and create one that contains only the columns you want. -- Until later, Geoffrey Any society that would give up a little liberty to gain a little security will deserve neither and lose both. - Benjamin Franklin
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Geoffrey wrote: > Chris wrote: >> Ricardo Vaz wrote: >>> Hi, >>> >>> >>> It is possible to copy data from text file (CSV) ignoring >>> some columns of this text file? > > Assuming you're on a Unix box, you could easily use awk or perl > to parse your csv and create one that contains only the columns > you want. And probably pipe the results directly into the copy command, bypassing any intermediary steps. - -- Ron Johnson, Jr. Jefferson LA USA Is "common sense" really valid? For example, it is "common sense" to white-power racists that whites are superior to blacks, and that those with brown skins are mud people. However, that "common sense" is obviously wrong. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.3 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFEm1vQS9HxQb37XmcRAkeiAKDiAvWlTcKPoYrV2V2M1KHqVujcegCg4TUf ctDcdCBkmwLoZ8CwWFahq7c= =GNho -----END PGP SIGNATURE-----
On Thu, 22 Jun 2006, Ron Johnson wrote: >> Assuming you're on a Unix box, you could easily use awk or perl to parse >> your csv and create one that contains only the columns you want. > > And probably pipe the results directly into the copy command, bypassing any > intermediary steps. Well, why not use the 'cut' command with 'ls' feeding it? Redirect output to a new file. Rich -- Richard B. Shepard, Ph.D. | The Environmental Permitting Applied Ecosystem Services, Inc.(TM) | Accelerator <http://www.appl-ecosys.com> Voice: 503-667-4517 Fax: 503-667-8863