Re: Converting comma-delimited data to tab-delimited

From: Frank Finner <postgresql(at)finner(dot)de>
To: Randall Perry <rgp(at)systame(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Converting comma-delimited data to tab-delimited
Date: 2002-03-31 20:04:13
Message-ID: XFMail.020331210413.postgresql@finner.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

if you just want to replace all commas by tabs, try this one:

perl -ne 's/,/\t/g; print $_;' file.csv > file.tab

mfg Frank.

On 31-Mar-02 Randall Perry sat down, thought for a long time and then
wrote:
> Searched through the archives and found this perl one-liner that's
> supposed
> to replace commas with tabs in text files.
>
> It worked in as much as it created the new output file; but the
> output was
> exactly the same as the input.
>
> Anyone know what's wrong? Or have another way to do this?
>
>
>
> perl -ne 's/^ *"//; s/" *$//; print join("\t", split(/\" *, *\"/))'
> your-table.csv > your-table.tab
>
>
> --
> Randy Perry
> sysTame
> Mac Consulting/Sales
>
> phn 561.589.6449
> mobile email help(at)systame(dot)com
>
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org

--
Frank Finner

Thus we are all responsible for one another, through all the myriad
dimensions of time and space that make up the multiverse . . .
(M. Moorcock, "The Revenge Of The Rose")

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Randall Perry 2002-03-31 20:08:50 Re: Converting comma-delimited data to tab-delimited
Previous Message Frank Finner 2002-03-31 20:00:13 Re: Converting comma-delimited data to tab-delimited