
Converting comma-delimited data to tab-delimited
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
Quote:
> 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
> ---------------------------(end of
> broadcast)---------------------------
> TIP 6: Have you searched our list archives?
> http://www.***.com/
--
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")
---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
message can get through to the mailing list cleanly