Computing.Net > Forums > Unix > csv processing using shell script

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

csv processing using shell script

Reply to Message Icon

Name: mazrkhan
Date: September 10, 2009 at 02:28:54 Pacific
OS: UNIX
Subcategory: General
Comment:

Hi There,


I have a strange problem:

The csv which i need to process has 3 columns as shown below

Test.csv

Column1,Coulmn2,Column3
"Floor 1, Suite 2, Rack3",122333,222222

The command

cut -d, -f 2,3 Test.csv > Test2.csv

gives Test2.csv

Coulmn2,Column3
Suite 2, Rack3

But i need

Coulmn2,Column3
122333,222222


Is this possible.

Please help



Sponsored Link
Ads by Google

Response Number 1
Name: pklinger
Date: September 10, 2009 at 13:27:28 Pacific
Reply:

Get rid of everything in quotes and keep everything after the the first comma.

cat test.csv | cut -d'"' -f3 | cut -d, -f2-


1
Reply to Message Icon

Related Posts

See More


Awk - split lines into ar... Shell Script to copy part...


Use following form to reply to current message:

Login or Register to Reply
LoginRegister


Sponsored links

Ads by Google


Results for: csv processing using shell script

Regarding file locking using shell script www.computing.net/answers/unix/regarding-file-locking-using-shell-script/1101.html

Process files using shell script www.computing.net/answers/unix/process-files-using-shell-script/3669.html

About Shell script - Need help www.computing.net/answers/unix/about-shell-script-need-help-/5796.html