![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
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 |
| Add single quotes in string | mrjunsy | UNIX for Dummies Questions & Answers | 1 | 07-18-2008 10:09 AM |
| Double quotes or single quotes when using ssh? | password636 | Shell Programming and Scripting | 3 | 05-29-2008 08:52 PM |
| awk to print ' (single quotes) | orahi001 | UNIX for Dummies Questions & Answers | 2 | 03-11-2008 04:30 PM |
| echo using single quotes | chella | Shell Programming and Scripting | 3 | 10-29-2007 12:54 AM |
| Filename containing Single Quotes | phani | Shell Programming and Scripting | 6 | 03-30-2005 06:47 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
single quotes in awk statement
Hi,
I have written a code to modify a string say, Code:
StringA=abc,def,ghi Code:
StringB=This means abc='ABC', This mean def='DEF', This means ghi= 'GHI' Code:
StringB=$(echo $StringA | awk -F',' 'BEGIN { OFS="," } { for (i=1; i<=NF;i++) $i="This means "$i"='ABC'")) THEN '' ELSE " $1 ; print $0 }')
|
|
||||
|
Sorry i forgot to put that in my earlier example. I did use the \ to escape the single quotes, but it doesn't work
Code:
StringB=$(echo $StringA | awk -F',' 'BEGIN { OFS="," } { for (i=1; i<=NF;i++) $i="This means "$i"=\'ABC\'")) THEN '' ELSE " $1 ; print $0 }')
|
| Sponsored Links | ||
|
|