Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printing single quote in nawk in solaris2.8

Status
Not open for further replies.

guest1

IS-IT--Management
Aug 21, 2002
10
0
0
US
Hi,

I was trying to create some datafile. How do you get a single quote after CA in that? When I give that it is throwing some error. Without that single quote it is working as normal.

Any idea?

echo |
nawk '{for (i=1; i <= 10; i++)
{printf &quot;CA's jose \n&quot;
}
}'
 
echo |
nawk -v apo=&quot;'&quot; '{for (i=1; i <= 10; i++)
{printf(&quot;CA%cs jose \n&quot;, apo)
}
}' vlad
+---------------------------+
|#include<disclaimer.h> |
+---------------------------+
 
I'm not shure if nawk supports octal/hexa representation of
ascii codes. If so, I prefer:
Code:
echo |
nawk '{for (i=0; i < 10; i++){
         print &quot;CA
\047
Code:
s jose&quot;
      }'
Where \047 is octal for 39 - ascii code of '.

PS: I changed the for loop var :)

jmagave
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top