![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| help me in sending parameters from sqlplus script to unix shell script | Hara | Shell Programming and Scripting | 2 | 01-29-2008 12:31 PM |
| Shell Script: want to insert values in database when update script runs | ring | Shell Programming and Scripting | 1 | 10-25-2007 12:06 AM |
| here document to automate perl script that call script | hogger84 | Shell Programming and Scripting | 3 | 10-22-2007 07:15 AM |
| returning to the parent shell after invoking a script within a script | gurukottur | Shell Programming and Scripting | 5 | 09-26-2006 04:05 AM |
| return valuse from child script to parent script | borncrazy | Shell Programming and Scripting | 1 | 08-20-2004 12:39 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
sed or an awk script should help
num desc ind code
11 hi,feather y food 121 edible,oil y food 100 meal-pack y food 010 health,prod 120 lunch,pack The above one is a flat file with the first line as column name.This is a comma delimited file with quote character as double quotes. ie desc column has fields like "Hi,Feather" or may be "Hi,Fea"ther" in short the record might look like "10","Hi,Feather","y","Food" this should go into the file but as in the example file above.Since delimiter is comma here ,I wud like to know if anyone can give me a script which can parse this the way i showed above and put into the file.ie Hi,Feather shud be in one column.Note: Its a vARIABLE LENGTH RECORD. |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
Because you have commas embedded inside the double-quoted text, this is not trivial.
Have a look a CVSparse and see if you can use it: http://www.visi.com/~hawkeyd/csvutils.3.html |
|
#3
|
||||
|
||||
|
is this what you want:
"10","Hi,Feather","y","Food" into 10 Hi,Feather y Food if that is the case you can simply do a sed... sed -e 's/\",\"/ /g' -e 's/\'//g' filename |
|
#4
|
||||
|
||||
|
Quote:
|
|
#5
|
||||
|
||||
|
typo error
should be: sed -e 's/\",\"/ /g' -e 's/\"//g' filename only human |
|
#6
|
|||
|
|||
|
Will be bak
Thanks All, I was really busy figuring out similar pbm at my work place, will let you know my feedbak asap
|
|||
| Google The UNIX and Linux Forums |