<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[向东博客 专注WEB应用 构架之美 --- 构架之美，在于尽态极妍 | 应用之美，在于药到病除]]></title> 
<link>http://www.jackxiang.com/index.php</link> 
<description><![CDATA[赢在IT，Playin' with IT,Focus on Killer Application,Marketing Meets Technology.]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[向东博客 专注WEB应用 构架之美 --- 构架之美，在于尽态极妍 | 应用之美，在于药到病除]]></copyright>
<item>
<link>http://www.jackxiang.com/post//</link>
<title><![CDATA[精华] awk中如何用print输出单引号，双引号。]]></title> 
<author>jack &lt;xdy108@126.com&gt;</author>
<category><![CDATA[WEB2.0]]></category>
<pubDate>Fri, 22 Jan 2010 10:09:52 +0000</pubDate> 
<guid>http://www.jackxiang.com/post//</guid> 
<description>
<![CDATA[ 
	用&#92;转义好像不行耶！<br/>如：<br/>echo &amp;quot;something&amp;quot; &#124; awk &#039;&#123;print &amp;quot;&#92;&#039;&amp;quot;&#125;&#039;<br/>时提示输入下一行，但下一行输入&amp;quot;<br/>报错：<br/>awk: cmd. line:1: &#123;print &amp;quot;&#92;&#125;&#039;<br/>awk: cmd. line:1:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;^ unterminated string<br/>谁来帮小弟一把！<br/><br/> awk中打印单引号<br/><br/><br/>碰巧要用awk生成一段sql脚本,所以涉及到在语句中打印出单引号的问题.<br/>&nbsp;&nbsp; EG1: 当为字符串时&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo aaa &#124; awk &#039;&#123;print &quot;select * from A where name=&#039;&#92;&#039;&#039;TOM&#039;&#92;&#039;&#039;&quot;&#125;&#039;<br/>&nbsp;&nbsp; EG2: 当为一字段时&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo TOM &#124; awk &#039;&#123;print &quot;select * from A where name=&#039;&#92;&#039;&#039;&quot;$1&quot;&#039;&#92;&#039;&#039;&quot;&#125;&#039;<br/>&nbsp;&nbsp; EG3: 当为shell中变量时 key=TOM; echo aaa &#124; awk &#039;&#123;print &quot;select * from A where name=&#039;&#92;&#039;&#039;&#039;$key&#039;&#039;&#92;&#039;&#039;&quot;&#125;&#039;<br/><br/>说明:把转义的单引号要用单引号括起来如 awk &#039;&#123;print &quot;&#039;&#92;&#039;&#039;&quot;&#125;&#039;<br/>&nbsp;&nbsp; EG1:单引-双引-单引-转义单引-单引-keyStr-单引-转义单引-单引-双引-单引<br/><br/>&nbsp;&nbsp; EG2:单引-双引-单引-转义单引-单引-双引-keyStr-双引-单引-转义单引-单引-双引-单引<br/><br/>&nbsp;&nbsp; EG2:单引-双引-单引-转义单引-单引-单引-keyStr-单引-单引-转义单引-单引-双引-单引<br/><br/>注意 : awk中括在双引号中的三种特殊字符不被忽略：$ , &#92; , ` , 即双引号会解释字符串的特别意思,而单引号直接使用字符串输出<br/><br/>举个栗子：<br/>cat bok.txt &#124;awk &#039;&#123;print $1&quot; &quot;$2&quot; &quot;$3&quot; &quot;$4 &quot; where uid=&#039;&#92;&#039;&#039;&quot;$5&quot;&#039;&#92;&#039;&#039;&quot;&#125;&#039;<br/>update object_uploadVideo set raw_file_path=&#039;/upload/video/share/XXXXXXXX-7964-11e5-803e-d43d7e0625c8.mpg&#039; where uid=&#039;XXXXXXXX-7964-11e5-803e-d43d7e0625c8&#039;<br/><br/><div class="code">cat /tmp/xxy_month_2.txt &#124;awk &#039;&#123;print &quot;select FQQ as QQNumber,count(*) as total_times from Tbl_ExchangeHistory where&nbsp;&nbsp;FQQ=&#039;&#92;&#039;&#039;&quot;$1&quot;&#039;&#92;&#039;&#039;&nbsp;&nbsp;group by FQQ;&quot;&#125;&#039;;</div><br/><br/>http://blog.oracle.com.cn/index.php/42136/viewspace-4800.html<br/>这个哥们好像更详细：http://www.cnblogs.com/emanlee/p/3620785.html<br/>awk输出单引号，双引号<br/>双引号：<br/><br/>awk &#039;&#123;print &quot;&#92;&quot;&quot;&#125;&#039;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#放大：awk &#039;&#123;print &quot;&nbsp;&nbsp;&#92;&quot;&nbsp;&nbsp;&quot;&#125;&#039;<br/><br/>使用“”双引号把一个双引号括起来，然后用转义字符&#92;对双引号进行转义，输出双引号。<br/><br/><br/>单引号：<br/><br/>awk &#039;&#123;print &quot;&#039;&#92;&#039;&#039;&quot;&#125;&#039;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # 放大: awk &#039;&#123;print&nbsp;&nbsp;&quot;&nbsp;&nbsp;&#039;&nbsp;&nbsp;&#92;&nbsp;&nbsp;&#039;&nbsp;&nbsp;&#039;&nbsp;&nbsp; &quot; &#125;&#039;<br/><br/>使用一个双引号“”，然后在双引号里面加入两个单引号‘’，接着在两个单引号里面加入一个转义的单引号&#92;&#039;，输出单引号。<br/>uuid输出双引号包裹起来示例：<br/>cat bok.txt &#124;awk &#039;&#123;print $1&quot; &quot;$2&quot; &quot;$3&quot; &quot;$4 &quot; where uid=&#92;&quot;&quot;$5&quot;&#92;&quot;&quot;&#125;&#039;<br/>update object_uploadVideo set raw_file_path=&#039;/upload/video/share/XXXXXXXX-7964-11e5-803e-d43d7e0625c8.mpg&#039; where uid=“XXXXXXXX-7964-11e5-803e-d43d7e0625c8”<br/><br/><br/>awk处理特殊字符(原创)之反引号(``)，反斜杠 backslash-escaped( &#92; )：<br/>http://czmmiao.iteye.com/blog/1887660
]]>
</description>
</item><item>
<link>http://www.jackxiang.com/post//#blogcomment</link>
<title><![CDATA[[评论] 精华] awk中如何用print输出单引号，双引号。]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>http://www.jackxiang.com/post//#blogcomment</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>