tags:

views:

365

answers:

5

This CSV file has a field delimiter of $
It looks like this:

14$"ALL0053"$$$"A"$$$"Direct Deposit in FOGSI A/c"$$"DR"$"DAS PRADIP ...

How can I view the file as columns, each field shown as in columns in a table.

I've tried many ways, none work. Any one knows how?

I am using Ubuntu

+2  A: 
cut -d $ -f 1,2,...x filename | sed 's/\$/ /g'

if you only want particular columns, and you don't want to see the $

or

sed 's/\$/ /g' filename

if you just want the $ to be replaced by a space

dnagirl
This doesn't actually do anything...you might as well invoke cat.
William Pursell
+2  A: 

That's a weird CSV. Since a comma-separated file is usually separated by, well, commas. I think all you need to do is use a simple find/replace available in any text editor.

Open the file in Gnome Edit and look under Edit > Replace...

From there you can specify to replace all $s with ,s

Once your file is a real CSV, you can open it in Open Office Calc (spreadsheet), or really any other spreadsheet program for Ubuntu (GNOME).

Jweede
A: 

As a first attempt:

column -ts'$' path

but this doesn't handle empty fields well, so fix that with this ugly hack:

sed 's/\$\$/$ $/g' path | column -ts$
William Pursell
+1  A: 

in ubuntu right-click on the file hit open with.. then OpenOffice Calc. then you should see a dialog box asking for delimiters etc. uncheck comma and and in the "other" field type a $. then hit okay and it will import it for you.

N

Nico
A: 

It is going to be hard to really add more to what others have said above - infact, 0% accept rate does say alot. And besides, that's not a CSV at all

Helen Neely