-   Programming (
-   -   CSV File (

AMMullan 11-09-2003 11:08 PM

CSV File
Hey all :)

I have a CSV file that I want to make into a big list, i.e.




What would be the best way to do this, I know I could run the command (a getent for samba), filter it through to one file and then replace with vi but I thought there'd be a better way...

Any ideas would be really helpful :)

eric.r.turner 11-10-2003 12:32 AM

You can do it with a single sh command line. The following command creates the list by replacing the commas with newlines, and sorts it in asciibetical order:


cat input.csv | sed 's/,/\n/g' | sort
If you want to, you can redirect the output to another file:


cat input.csv | sed 's/,/\n/g' | sort > output.list

AMMullan 11-10-2003 12:49 AM

The power of sed. I've got a couple of scripts with it in but I still haven't figured it out lol :P

Thanks for ur help, worked perfectly :)

All times are GMT -5. The time now is 02:16 PM.