[H-GEN] Converting csv file to tab delimited text file

Kelvin Heng kelvinheng at hotmail.com
Wed Jun 7 01:25:26 EDT 2006


I have attached the sample.csv, if you open the file using vim, you will see 
that each field is tagged using "" and separated by ,

I have no problem doing a awk using field delimitor , but do not know how to 
remove the " without causing problem to my original data.

So I find the safe way is to open using excel spreadsheet and save it as tab 
delimited text file.

Regards,
Kelvin Heng
Have A Nice Day!




>From: Ted Percival <ted at midg3t.net>
>To: general at lists.humbug.org.au
>Subject: Re: [H-GEN] Converting csv file to tab delimited text file
>Date: Wed, 07 Jun 2006 14:14:30 +1000
>
>[ Humbug *General* list - semi-serious discussions about Humbug and     ]
>[ Unix-related topics. Posts from non-subscribed addresses will vanish. ]
>
>Kelvin Heng wrote:
> > I am writing scripts using bash shell in cygwin. Right now, I have a set
> > of raw data that is daily exported from a server into a csv format. My
> > script can only process a Tab Delimited text file, so I have to open the
> > file in excel and save it as Tab Delimited text file. Anyone has any
> > alternative to automate this process? Please comments.
>
>I've never really had to deal with CSV or tab delimited files, but
>either of the following might be close to what you're after.
>
>Given the file 'file' with the following contents:
>a,b,c
>d,e,f
>
>To replace the commas with tabs (presumably that's all you need), try:
>tr , '\t' < file
>or:
>sed -e 's/,/\t/g' file
>
>You can use shell redirection to output to a file, or the non-standard
>'-i' flag for sed to do in-place editing.
>
>-Ted
>
>_______________________________________________
>General mailing list
>General at lists.humbug.org.au
>http://lists.humbug.org.au/cgi-bin/mailman/listinfo/general

-------------- next part --------------
A non-text attachment was scrubbed...
Name: sample.csv
Type: application/octet-stream
Size: 1018 bytes
Desc: not available
URL: <http://lists.humbug.org.au/pipermail/general/attachments/20060607/1b3a2e87/attachment.obj>


More information about the General mailing list