![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | 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 and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Remove double quotes | deepakwins | UNIX for Dummies Questions & Answers | 3 | 05-30-2008 12:53 PM |
| Double quotes or single quotes when using ssh? | password636 | Shell Programming and Scripting | 3 | 05-29-2008 09:52 PM |
| How do I insert double quotes | dsean | Shell Programming and Scripting | 3 | 05-26-2006 02:28 PM |
| Double Quotes within a variable | burton_1080 | Shell Programming and Scripting | 4 | 12-01-2005 01:44 PM |
| PERL, extract value between double quotes | methos | Shell Programming and Scripting | 6 | 06-06-2003 01:24 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
put double quotes for a column
Hi,
I have a file which looks like this, I have stripped most of the columns: 2006,UCA,"02452","NM","1","M","84",123,aa 2006,UCA,"02452","NM","1","L","84",123,bb 2006,UCA,"02452","NM","1","L","84",432,cc 2006,UCA,"02452","NM","1","L","33",213,dd 2006,UCA,"02452","NM","1","L","33",124,ee 2006,UCA,"02452","NM","5","H","84",325,ff 2006,UCA,"02452","NM","1","H","84",233,dd 2006,UCA,"02452","NM","1","H","84",543,dd 2006,UCA,"02452","NM","5","H","84",235,ff 2006,UCA,"02452","NM","1","L","33",233,dd I have to replace second column UCA with "MMU". Mind you its not just MMU its MMU with double quotes. I have replaced UCA with MMU but could not put double quotes. 2006,MMU,"02452","NM","1","M","84",123,aa 2006,MMU,"02452","NM","1","L","84",123,bb 2006,MMU,"02452","NM","1","L","84",432,cc 2006,MMU,"02452","NM","1","L","33",213,dd 2006,MMU,"02452","NM","1","L","33",124,ee 2006,MMU,"02452","NM","5","H","84",325,ff 2006,MMU,"02452","NM","1","H","84",233,dd 2006,MMU,"02452","NM","1","H","84",543,dd 2006,MMU,"02452","NM","5","H","84",235,ff 2006,MMU,"02452","NM","1","L","33",233,dd So my awk looks like this : awk -F, '{OFS=","; if ($2~/UCA/) print $1,"MMU",$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14 }' test Is there any way to do this and not type each column number like $3,$4,$5... Thanks Sumeet |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|