﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-世界因你而精彩-随笔分类-资料查找</title><link>http://www.blogjava.net/etlan/category/21943.html</link><description>Good Good Study, Up Up Day&lt;br&gt;
&lt;td vAlign="top" width="135"&gt;&lt;span id="ymd"&gt;&lt;/span&gt;&lt;/td&gt;
&amp;nbsp;&amp;nbsp;
&lt;td vAlign="top" width="135"&gt;&lt;span id="week_date"&gt;&lt;/span&gt;&lt;/td&gt;&lt;br&gt;
&lt;td vAlign="top" width="135"&gt;您在此逗留了：
&lt;span id="stay_time"&gt;&lt;/span&gt;&lt;/td&gt;</description><language>zh-cn</language><lastBuildDate>Thu, 24 Apr 2008 22:21:52 GMT</lastBuildDate><pubDate>Thu, 24 Apr 2008 22:21:52 GMT</pubDate><ttl>60</ttl><item><title>SourceOffsite安装配置</title><link>http://www.blogjava.net/etlan/archive/2008/04/24/195437.html</link><dc:creator>张秀兰</dc:creator><author>张秀兰</author><pubDate>Thu, 24 Apr 2008 02:40:00 GMT</pubDate><guid>http://www.blogjava.net/etlan/archive/2008/04/24/195437.html</guid><wfw:comment>http://www.blogjava.net/etlan/comments/195437.html</wfw:comment><comments>http://www.blogjava.net/etlan/archive/2008/04/24/195437.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/etlan/comments/commentRss/195437.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/etlan/services/trackbacks/195437.html</trackback:ping><description><![CDATA[安装配置指南<br />
------------<br />
一、下载SourceOffsite V3.53<br />
官方下载地址，可以试用30天，试用期间无任何功能限制。<br />
http://www.sourcegear.com/sos/downloads/SOS_Classic_3_5_3.zip<br />
现在国内也有相关的中文版下载，本人使用没有什么区别，可能就是多一个VSS6.0。如果大家连VSS6.0都没有，就建议下载中文版。<br />
<br />
二、安装SourceOffsite 服务器端<br />
程序安装路径:<br />
"下载保存路径\\SOS_Classic_3_5_3.zip\\vss6\\sos_server_winnt_professional_vss6.exe"。<br />
安装过程结束后要提示重新启动系统，选择取消，不用重新启动也行，因为有的文章介绍说可以不重新启动。如果大家慎重一点，可以选择重新启动，本人就选择了重新启动。<br />
<br />
三、配置SourceOffsite 服务器端<br />
启动SourceOffsite 服务器端程序，程序路径为:"C:\\Program Files\\SourceOffSite\\ServerMgr.exe"，也可以在Windows开始程序菜单中启动。其实 SourceOffsite 的用户指南里面有详细的软件使用及配置说明，在这里只能介绍几个重要的配置信息，其他设置使用默认值就可以。<br />
1、网络端口设置(port)<br />
打开程序的"General Settings"页面即可看到。<br />
这里的端口只要不和其他网络端口冲突就行，一般默认值就不要修改了。<br />
本人测试的端口号为:<br />
unsecure port :8888，不用加密访问的端口。<br />
secure port :8890，加密时访问的端口。<br />
<br />
2、VSS数据库的设置(databases )<br />
打开程序的"databases"页面，选择"Add..."，出现添加数据库的对话框，选择已经存在的数据库srcsafe.ini，在DataBase 框中就会有数据库的完整路径，在DataBase Alias（数据库别名）中输入数据库名称也可以，为了测试方便本人输入了"net_vss"。<br />
这里只要把要共享的数据库都选择出来就行，真正的配置管理员可能会有很多VSS数据库。<br />
<br />
3、用户访问规则设置(users)<br />
下面的规则设置方法，是网上搜索得到的很有效，在自带的用户指南中没有介绍。<br />
举例的缺省规则:<br />
0000 admin 192.168.3.0/24 1 来自 192.168.3.* 的 admin 必须加密访问<br />
0001 admin 0.0.0.0/0 0 其它网段的 admin 用户拒绝访问<br />
0002 * 192.168.3.0/24 2 其它来自 192.168.3.* 的用户可以访问<br />
0003 * 0.0.0.0/0 1 其它网段的其它用户必须加密访问<br />
每条规则有 4 个字段，第一个字段为规则优先级，按照 0000 0001 0002 ... 9999 排列<br />
第二个字段为 用户名 匹配，如果为 * 表示全匹配。<br />
第三个字段为 IP/子网 匹配。<br />
192.168.3.1 表示匹配单机 192.168.3.1。<br />
192.168.3.0/24 表示匹配 192.168.3.*<br />
166.111.0.0/16 表示匹配清华校园网。<br />
0.0.0.0/0 表示匹配所有的IP。<br />
第四个字段为 控制项，可选为<br />
0 表示拒绝访问<br />
1 表示要求加密访问<br />
2 表示可以访问<br />
打开程序的"Users"页面，本人的测试规则为"0000 * 0.0.0.0/0 2"允许所有的用户不加密访问，把测试规则输入到"SourceSafe user name"框中即可。<br />
大家设置时请按需要修改规则。<br />
<br />
四、启动SourceOffsite 服务<br />
打开Windows的系统服务找到SourceOffsite 启动服务即可。大家要注意以后修改任何的服务器端配置后都要重新启动SourceOffsite 服务才能生效。<br />
<br />
五、安装SourceOffsite 客户端<br />
为了后面好配置，测试功能，本人就在服务器端机器上安装客户端了，大家也可以这样先测试一下。<br />
程序安装路径:<br />
"下载保存路径\\SOS_Classic_3_5_3.zip\\Windows\\sos_client_professional.exe"。<br />
安装过程中没的任何困难的地方，这里就不做过多介绍了。<br />
<br />
六、使用SourceOffsite 客户端<br />
使用步骤以本人的测试步骤为例:<br />
1、连接服务器对话框，输入服务器地址"Server":127.0.0.1，端口号"Prot":8888，选择连接"Connect"。<br />
2、VSS数据库登录对话框，输入VSS用户名"Username":t1，用户密码"Password":t1，VSS数据库别名"Database":net_vss。<br />
3、验证正确后，就可以看到VSS数据库的内容了，关于VSS的操作就不做介绍了。<br />
到此就成功地实现了VSS(Visual SourceSafe)的Internet访问。<img src ="http://www.blogjava.net/etlan/aggbug/195437.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/etlan/" target="_blank">张秀兰</a> 2008-04-24 10:40 <a href="http://www.blogjava.net/etlan/archive/2008/04/24/195437.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>恢复Eclipse误删的文件</title><link>http://www.blogjava.net/etlan/archive/2008/04/23/195121.html</link><dc:creator>张秀兰</dc:creator><author>张秀兰</author><pubDate>Wed, 23 Apr 2008 07:22:00 GMT</pubDate><guid>http://www.blogjava.net/etlan/archive/2008/04/23/195121.html</guid><wfw:comment>http://www.blogjava.net/etlan/comments/195121.html</wfw:comment><comments>http://www.blogjava.net/etlan/archive/2008/04/23/195121.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/etlan/comments/commentRss/195121.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/etlan/services/trackbacks/195121.html</trackback:ping><description><![CDATA[Java视图上，左边&#8220;包资源管理器&#8221;，在要恢复的项目上点右键，会有一个菜单项，&#8220;从本地历史纪录复原（X）...&#8221;，英文是&#8221;Restore from Local History...&#8221;，点这个，就会弹出一个对话框，原来他们藏在这里了！对应于每一个删除的文件右边有相应的保存的日期，有更改就有保存，点对应的时间可以在下方看到代码，选中想要回复的文件，点恢复，就可以看到它乖乖的回到了原来的地方！
<p>值得说明的是，Eclipse保存这些删掉的文件是有时间期限的，应该也有空间的限制。有些文件虽然可以看到文件名和更改时间，但是内容已经不存在了！这时会提示你状态无效或已经过期</p><img src ="http://www.blogjava.net/etlan/aggbug/195121.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/etlan/" target="_blank">张秀兰</a> 2008-04-23 15:22 <a href="http://www.blogjava.net/etlan/archive/2008/04/23/195121.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>转：Java正则表达式</title><link>http://www.blogjava.net/etlan/archive/2008/04/16/193452.html</link><dc:creator>张秀兰</dc:creator><author>张秀兰</author><pubDate>Wed, 16 Apr 2008 07:13:00 GMT</pubDate><guid>http://www.blogjava.net/etlan/archive/2008/04/16/193452.html</guid><wfw:comment>http://www.blogjava.net/etlan/comments/193452.html</wfw:comment><comments>http://www.blogjava.net/etlan/archive/2008/04/16/193452.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/etlan/comments/commentRss/193452.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/etlan/services/trackbacks/193452.html</trackback:ping><description><![CDATA[正则表达式用来指定字符串模式。当你需要定位匹配某种模式的字符串时就可以使用正则表达式。例如，我们下面的一个例程就是在一个HTML文件中通过查找字符串模式&lt;a href="..."&gt;来定位所有的超链接。<br />
<br />
&nbsp;&nbsp;&nbsp; 当然，为了指定一种模式，使用...这种记号是不够精确的。你需要精确地指定什么样的字符排列是一个合法的匹配。当描述某种模式时，你需要使用一种特殊的语法。<br />
<br />
&nbsp;&nbsp;&nbsp; 这里有一个简单例子。正则表达式<br />
[Jj]ava.+<br />
匹配下列形式的任何字符串：<br />
<ul>
    <li>首字母是J或j </li>
</ul>
<ul>
    <li>后续的三个字母是ava </li>
</ul>
<ul>
    <li>字符串的剩余部分由一个或多个任意字符组成 </li>
</ul>
<br />
&nbsp;&nbsp;&nbsp; 例如，字符串&#8220;javaness&#8221;匹配这个特殊的正则表达式，但是字符串&#8220;Core Java&#8221;却不匹配。<br />
<br />
&nbsp;&nbsp;&nbsp; 如你所见，你需要了解一点语法来理解正则表达式的含意。幸运的是对于大多数的用途，使用少量的简单构造（straightforward constructs）就已足够。<br />
<ul>
    <li>字符类是可选自符的集合，用&#8216;[&#8217;封装，比如[Jj],[0-9],[A-Za-z]或[^0-9]。这里的-表示范围（Unicode落在两个边界之间的所有字符），^表示求补（指定字符外的所有字符）。 </li>
</ul>
<ul>
    <li>有许多预定以的字符类，像\d（数字）或\p{Sc}（Unicode货币符号），见表12-8和12-9。 </li>
</ul>
<ul>
    <li>大多数字符与它们自身匹配，像上例中的ava字符。 </li>
</ul>
<ul>
    <li>符号.匹配任何字符（可能行终止符（line terminators）除外，这依赖于标识设置（flag settings）） </li>
</ul>
<ul>
    <li>\用作转义符，比如\.匹配一个句点，\\匹配一个反斜杠。 </li>
</ul>
<ul>
    <li>&nbsp;^和$分别匹配行头和行尾 </li>
</ul>
<ul>
    <li>如果X和Y都是正则表达式，则XY表示&#8220;X的匹配后面跟着Y的匹配&#8221;。X|Y表示&#8220;任何X或Y的匹配&#8221; </li>
</ul>
<ul>
    <li>可以将量词（quantifier）用到表达式中，X+ 表示X重复1次或多次，X* 表示X重复0次或多次，X? 表示X重复0次或1次 </li>
</ul>
<ul>
    <li>&nbsp;默认地，一个量词总是与使总体成功匹配的最长的可能重复匹配。可以加上后缀？（称为reluctant或stingy 匹配，用以匹配最小的重复数），和+（称为possessive或贪婪匹配，用以即使在总体匹配失败的情况下也匹配最大的重复数）来更改这种属性。 </li>
</ul>
<br />
<div style="margin-left: 40px" twffan="done">例如，字符串cab匹配[a-z]*ab，但不匹配[a-z]*+ab。第一种情况下，[a-z]*只匹配字符c，因此字符ab正好与模式的剩余部分匹配。但是贪婪版本[a-z]*+就与字符cab匹配，模式的剩余部分ab就匹配失败（，这样总体也就匹配失败）。<br />
</div>
<ul>
    <li>可以使用分组来定义子表达式。将分组封装在（）中，如([+-]?)([0-9]+)。然后你可以让模式匹配符（the pattern matcher）返回每个分组的匹配，或者使用\n来回引分组（refer back to a group with \n），其中n是组号（以\1起始） </li>
</ul>
<br />
&nbsp;&nbsp;&nbsp; 这里有一个稍微有点复杂却又很有用的正则表达式－－它用来描述十进制和十六进制的整数。<br />
[+-]?[0-9]+|0[Xx][0-9A-Fa-f]+<br />
<br />
&nbsp;&nbsp;&nbsp; 不幸的是，在使用正则表达式的各种程序和库之间，它的语法还没有完全标准化。对基本的构造上已达成了共识，但在细节方面有许多令人&#8220;抓狂&#8221;的区别（many maddening differences）。Java的正则表达式类使用了与Perl语言类似的语法，但也不尽相同。表12-8显示了Java语法的所有正则表达式构造。要了解更多关于正则表达式的信息，请参考Pattern类的API文档，或者Jeffrey E. F. Friedl的著作《Mastering Regular Expressions》(O'Reilly and Associates, 1997)（刚去第二书店查了一下，东南大学出版社已经引入了其第二版，影印）<br />
<br />
表12-8 正则表达式语法<br />
<hr style="width: 100%; height: 2px" />
<span style="font-weight: bold" twffan="done">语法&nbsp;&nbsp;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="font-weight: bold" twffan="done"> 解释</span><br />
<hr style="width: 100%; height: 2px" />
<span style="font-weight: bold" twffan="done">字符</span><br />
c&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 字符c<br />
\unnnn, \xnn, \0n, \0nn, \0nnn&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 带有十六或八进制值的代码单元<br />
<div style="margin-left: 40px" twffan="done">\0n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 八进制0n代表的字符（0&lt;=n&lt;=7）<br />
</div>
<div style="margin-left: 40px" twffan="done">\0nn&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 八进制0nn代表的字符(0&lt;=n&lt;=7)<br />
</div>
<div style="margin-left: 40px" twffan="done">\0mnn&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 八进制0mnn代表的字符(0&lt;=m&lt;=3,0&lt;=n&lt;=7)<br />
</div>
<div style="margin-left: 40px" twffan="done">\xnn&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 十六进制 0xnn所代表的字符<br />
</div>
<div style="margin-left: 40px" twffan="done">\uhhhh&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 十六进制 0xhhhh所代表的字符<br />
</div>
\t, \n, \r, \f, \a, \e&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 控制字符，依次是制表符，换行符，回车符，换页符，报警符和转义符<br />
\cc&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 控制字符中出现的相应字符c<br />
<hr style="width: 100%; height: 2px" />
<span style="font-weight: bold" twffan="done">字符类</span><br />
[C1C2. . .]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; C1、C2&#8230;&#8230;中的任何字符。Ci可以是字符，字符范围（C1-C2）或者字符类。<br />
[^. . .]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 字符类的补集<br />
[ . . . &amp;&amp; . . .]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 两个字符类的交集<br />
<hr style="width: 100%; height: 2px" />
<span style="font-weight: bold" twffan="done">预定义字符类</span><br />
.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 除行终止符外的任何字符（如果DOTALL标志置位，则表示任何字符）<br />
\d&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 数字[0-9]<br />
\D&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 非数字[^0-9]<br />
\s&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 空白字符[\t\n\r\f\x0B]<br />
\S&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 非空白字符<br />
\w&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 单词字符[a-zA-Z0-9_]<br />
\W&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 非单词字符<br />
\p{name}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 一个指定的字符类，见表12-9<br />
\P{name}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 指定字符类的补集<br />
<hr style="width: 100%; height: 2px" />
<span style="font-weight: bold" twffan="done">边界匹配符</span><br />
^ $&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 输入的开头和结尾(在多行模式(multiline mode)下是行的开头和结尾)<br />
\b&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 单词边界<br />
\B&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 非单词边界<br />
\A&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 输入的开头<br />
\z&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 输入的结尾<br />
\Z&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 除最后行终止符之外的输入结尾<br />
\G&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 上个匹配的结尾<br />
<hr style="width: 100%; height: 2px" />
<span style="font-weight: bold" twffan="done">量词</span><br />
X?&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 可选的X（即X可能出现，也可能不出现）<br />
X*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; X，可以重复0次或多次<br />
X+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; X，可以重复1次或多次<br />
X{n} X{n,} X{n,m}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; X重复n次，至少重复n次，重复n到m次<br />
<hr style="width: 100%; height: 2px" />
<span style="font-weight: bold" twffan="done">量词后缀</span><br />
?&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 设默认（贪婪）匹配为reluctant匹配<br />
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 设默认（贪婪）匹配为possessive匹配<br />
<hr style="width: 100%; height: 2px" />
<span style="font-weight: bold" twffan="done">集合操作</span><br />
XY&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; X的匹配后面跟着Y的匹配<br />
X|Y&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; X或Y的匹配<br />
<hr style="width: 100%; height: 2px" />
<span style="font-weight: bold" twffan="done">分组</span><br />
(X) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; 匹配X并且在一个自动计数的分组中捕获它<br />
\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 与第n个分组的匹配<br />
<hr style="width: 100%; height: 2px" />
<span style="font-weight: bold" twffan="done">转义</span><br />
\c&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 字符c（必须不是字母）<br />
\Q...\E&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 逐字地引用...<br />
（？...）&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 特殊构造，看Pattern类的API<br />
<hr style="width: 100%; height: 2px" />
<br />
&nbsp;&nbsp;&nbsp; 正则表达式的最简单使用是测试一个特殊的字符串是否与之匹配。这里有一个Java写的测试程序。首先从表示正则表达式的字符串构造一个Pattern对象。然后从该模式获得一个Matcher对象，并且调用它的matches()方法：<br />
<div style="margin-left: 40px" twffan="done">Pattern pattern = Pattern.compile(patternString);<br />
</div>
<div style="margin-left: 40px" twffan="done">Matcher matcher = pattern.matcher(input);<br />
</div>
<div style="margin-left: 40px" twffan="done">if (matcher.matches()) . . .<br />
</div>
<br />
&nbsp;&nbsp;&nbsp; 表12.9 预定义的字符类名（Predefined Character Class Names）<br />
<hr style="width: 100%; height: 2px" />
Lower&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 小写的ASII字符[a-z]<br />
Upper&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 大写的ASCII字符[A-Z]<br />
Alpha&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ASCII字母[A-Za-z]<br />
Digit&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ASCII 数字 [0-9]<br />
Alnum &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; ASCII 字母或数字[A-Za-z0-9]<br />
Xdigit&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 十六进制数字[0-9A-Fa-f] <br />
Print or Graph &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; 可打印的ASCII字符[\x21-\x7E]<br />
Punct&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 非字母或数字ASCII [\p{Print}&amp;&amp;\P{Alnum}] <br />
ASCII&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 所有ASCII字符 [\x00-\x7F]<br />
Cntrl&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ASCII控制字符[\x00-\x1F]<br />
Blank&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 空格符或制表符[ \t]<br />
Space&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 空白符 [ \t\n\r\f\0x0B]<br />
javaLowerCase&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 取决于Character.isLowerCase()的小写字符<br />
javaUpperCase &nbsp; &nbsp;&nbsp; 取决于Character.isUpperCase()的大写字符<br />
javaWhitespace&nbsp;&nbsp;&nbsp;&nbsp; 取决于Character.isWhitespace()的空白符<br />
javaMirrored &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;&nbsp; 取决于Character.isMirrored()的Mirrored（？） <br />
InBlock&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 这里的Block是unicode字符的块名，用空格隔开，比如BasicLatin 或 Mongolian。块名列表&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 参考http://www.unicode.org<br />
Category 或InCategory&nbsp;&nbsp;&nbsp;&nbsp; 这里的Category是Unicode字符的种类名，比如L（字母）或者Sc（货币符号）。种类&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 名列表参考http://www.unicode.org&nbsp; <br />
<hr style="width: 100%; height: 2px" />
<br />
&nbsp;&nbsp;&nbsp; matcher的输入可以是实现CharSequence接口的任何类对象，像String，StringBuilder或CharBuffer。<br />
<br />
&nbsp;&nbsp;&nbsp; 当编译模式时，可以设置一个或多个标志，例如<br />
<div style="margin-left: 40px" twffan="done">Pattern pattern = Pattern.compile(patternString,<br />
</div>
<div style="margin-left: 40px" twffan="done">Pattern.CASE_INSENSITIVE + Pattern.UNICODE_CASE);<br />
</div>
<br />
下面六个标志都是支持的：<br />
<div style="margin-left: 40px" twffan="done">CASE_INSENSITIVE：匹配字符时与大小写无关，该标志默认只考虑US ASCII字符。<br />
</div>
<div style="margin-left: 40px" twffan="done">UNICODE_CASE：当与CASE_INSENSITIVE结合时，使用Unicode字母匹配<br />
</div>
<div style="margin-left: 40px" twffan="done">MULTILINE：^和$匹配一行的开始和结尾，而不是整个输入<br />
</div>
<div style="margin-left: 40px" twffan="done">UNIX_LINES： 当在多行模式下匹配^和$时，只将'\n'看作行终止符<br />
</div>
<div style="margin-left: 40px" twffan="done">DOTALL: 当使用此标志时，.符号匹配包括行终止符在内的所有字符<br />
</div>
<div style="margin-left: 40px" twffan="done">CANON_EQ: 考虑Unicode字符的规范等价<br />
<br />
</div>
&nbsp;&nbsp;&nbsp;&nbsp; 如果正则表达式包含分组，Matcher对象能够揭示分组边界。方法<br />
<div style="margin-left: 40px" twffan="done">int start(int groupIndex)<br />
</div>
<div style="margin-left: 40px" twffan="done">int end(int groupIndex)<br />
</div>
返回某个特殊分组的起始索引和结尾后索引（past-the-end index ）。<br />
通过调用String group(int groupIndex)，你可以简单地得到匹配的字符串。<br />
第0个分组代表所有的分组，第一个实际分组的索引是1。调用groupCount来获得总的分组数。<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp; 使用开放圆括号来安排嵌套分组。例如，给定模式((1?[0-9]):([0-5][0-9]))[ap]m，并且输入11:59am,Matcher对象报告下列分组<br />
((1?[0-9]):([0-5][0-9]))[ap]m<br />
并输入<br />
11:59am<br />
matcher报告下列分组<br />
<br />
<hr style="width: 100%; height: 2px" />
分组索引&nbsp; 起始&nbsp; 结束&nbsp; 字符串<br />
<hr style="width: 100%; height: 2px" />
0 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; 0 &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; 7 &nbsp;&nbsp;&nbsp;&nbsp; 11;59am<br />
1 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; 0 &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; 5 &nbsp; &nbsp;&nbsp; 11:59<br />
2 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; 0 &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; 2 &nbsp; &nbsp;&nbsp; 11<br />
3 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; 3 &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; 5 &nbsp; &nbsp;&nbsp; 59<br />
<hr style="width: 100%; height: 2px" />
&nbsp;<br />
例12－9提示输入一个模式和一个欲匹配的字符串。它将输出输入的字符串是否匹配模式。如果输入匹配包含分组的模式，程序将会使用圆括号来打印分组边界，如((11):(59))am<br />
<br />
Example 12-9. RegexTest.java<br />
import java.util.*;<br />
import java.util.regex.*;<br />
&nbsp;/**<br />
&nbsp; This program tests regular expression matching.<br />
&nbsp;&nbsp; Enter a pattern and strings to match, or hit Cancel<br />
&nbsp;&nbsp;&nbsp; to exit. If the pattern contains groups, the group<br />
&nbsp;&nbsp;&nbsp; boundaries are displayed in the match.<br />
&nbsp;*/<br />
public class RegExTest<br />
{<br />
&nbsp; public static void main(String[] args)<br />
&nbsp; {<br />
&nbsp;&nbsp;&nbsp;&nbsp; Scanner in = new Scanner(System.in);<br />
&nbsp;&nbsp;&nbsp;&nbsp; System.out.println("Enter pattern: ");<br />
&nbsp;&nbsp;&nbsp;&nbsp; String patternString = in.nextLine();<br />
<br />
&nbsp;&nbsp;&nbsp; Pattern pattern = null;<br />
&nbsp;&nbsp;&nbsp;&nbsp; try<br />
&nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pattern = Pattern.compile(patternString);<br />
&nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;catch (PatternSyntaxException e)<br />
&nbsp;&nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.out.println("Pattern syntax error");<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.exit(1);<br />
&nbsp;&nbsp;&nbsp; }<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp; while (true)<br />
&nbsp;&nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.out.println("Enter string to match: ");<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; String input = in.nextLine();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (input == null || input.equals("")) return;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Matcher matcher = pattern.matcher(input);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (matcher.matches())<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.out.println("Match");<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int g = matcher.groupCount();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (g &gt; 0)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for (int i = 0; i &lt; input.length(); i++)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for (int j = 1; j &lt;= g; j++)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (i == matcher.start(j))<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.out.print('(');<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.out.print(input.charAt(i));<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for (int j = 1; j &lt;= g; j++)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (i + 1 == matcher.end(j))<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.out.print(')');<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.out.println();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.out.println("No match");<br />
&nbsp;&nbsp;&nbsp; }<br />
&nbsp; }<br />
}<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp; 通常地，你不希望匹配整个输入到某个正则表达式，而是希望在输入中找出一个或多个匹配的子字符串。使用Matcher类的find方法来寻找下一个匹配。如果它返回True，再使用start和end方法找出匹配的范围。<br />
<br />
<div style="margin-left: 40px" twffan="done">while (matcher.find())<br />
</div>
<div style="margin-left: 40px" twffan="done">{<br />
</div>
<div style="margin-left: 40px" twffan="done">&nbsp;&nbsp; int start = matcher.start();<br />
</div>
<div style="margin-left: 40px" twffan="done">&nbsp;&nbsp; int end = matcher.end();<br />
</div>
<div style="margin-left: 40px" twffan="done">&nbsp;&nbsp; String match = input.substring(start, end);<br />
</div>
<div style="margin-left: 40px" twffan="done">&nbsp;&nbsp; . . .<br />
</div>
<div style="margin-left: 40px" twffan="done">}<br />
</div>
<br />
例12-10用到了这种机制。它在一个网页中定位所有的超文本引用并打印它们。为运行程序，在命令行提供一个URL，比如<br />
java HrefMatch http://www.horstmann.com<br />
<br />
Example 12-10. HrefMatch.java<br />
&nbsp;1. import java.io.*;<br />
&nbsp;2. import java.net.*;<br />
&nbsp;3. import java.util.regex.*;<br />
&nbsp;4.<br />
&nbsp;5. /**<br />
&nbsp;6.&nbsp;&nbsp;&nbsp; This program displays all URLs in a web page by<br />
&nbsp;7.&nbsp;&nbsp;&nbsp; matching a regular expression that describes the<br />
&nbsp;8.&nbsp;&nbsp;&nbsp; &lt;a href=...&gt; HTML tag. Start the program as<br />
&nbsp;9.&nbsp;&nbsp;&nbsp; java HrefMatch URL<br />
10. */<br />
11. public class HrefMatch<br />
12. {<br />
13.&nbsp;&nbsp;&nbsp; public static void main(String[] args)<br />
14.&nbsp;&nbsp;&nbsp; {<br />
15.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; try<br />
16.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />
17.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // get URL string from command line or use default<br />
18.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; String urlString;<br />
19.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (args.length &gt; 0) urlString = args[0];<br />
20.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else urlString = "http://java.sun.com";<br />
21.<br />
22.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // open reader for URL<br />
23.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; InputStreamReader in = new InputStreamReader(new URL(urlString).openStream());<br />
24.<br />
25.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // read contents into string buffer<br />
26.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; StringBuilder input = new StringBuilder();<br />
27.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int ch;<br />
28.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; while ((ch = in.read()) != -1) input.append((char) ch);<br />
29.<br />
30.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // search for all occurrences of pattern<br />
31.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; String patternString = "&lt;a\\s+href\\s*=\\s*(\"[^\"]*\"|[^\\s&gt;])\\s*&gt;";<br />
32.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Pattern pattern = Pattern.compile(patternString, Pattern.CASE_INSENSITIVE);<br />
33.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Matcher matcher = pattern.matcher(input);<br />
34.<br />
35.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; while (matcher.find())<br />
36.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />
37.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int start = matcher.start();<br />
38.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int end = matcher.end();<br />
39.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; String match = input.substring(start, end);<br />
40.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.out.println(match);<br />
41.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />
42.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />
43.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; catch (IOException e)<br />
44.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />
45.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; e.printStackTrace();<br />
46.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />
47.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; catch (PatternSyntaxException e)<br />
48.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />
49.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; e.printStackTrace();<br />
50.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />
51.&nbsp;&nbsp;&nbsp; }<br />
52. }<br />
<br />
&nbsp;&nbsp;&nbsp; Matcher类的replaceAll方法用一个替换字符串代替出现的所有正则表达式的匹配。比如，下列指令用#替换所有数字序列<br />
<br />
<div style="margin-left: 40px" twffan="done">Pattern pattern = Pattern.compile("[0-9]+");<br />
</div>
<div style="margin-left: 40px" twffan="done">Matcher matcher = pattern.matcher(input);<br />
</div>
<div style="margin-left: 40px" twffan="done">String output = matcher.replaceAll("#");<br />
</div>
&nbsp;&nbsp;&nbsp; 替换字符串可以包含模式中的分组引用：$n被第n个分组替换。替换文本中出现$时，使用\$来包含它。<br />
replaceFirst方法只替换模式的第一次出现。<br />
<br />
&nbsp;&nbsp;&nbsp; 最后讲一点，Pattern类有一个split方法，它类似于字符串tokenizer。它使用正则表达式匹配作边界，将输入分离成字符串数组。比如，下面的指令将输入分离成记号（token），<br />
<br />
<div style="margin-left: 40px" twffan="done">Pattern pattern = Pattern.compile("\\s*\\p{Punct}\\s*");<br />
</div>
<div style="margin-left: 40px" twffan="done">String[] tokens = pattern.split(input);<br />
</div>
<br />
<span style="font-weight: bold" twffan="done">类</span><br />
<hr style="width: 100%; height: 2px" />
java.util.regex.Pattern 1.4<br />
<hr style="width: 100%; height: 2px" />
<span style="font-weight: bold" twffan="done">方法</span><br />
static Pattern compile(String expression)<br />
static Pattern compile(String expression, int flags)<br />
编译正则表达式字符串到pattern对象用以匹配的快速处理<br />
参数:<br />
&nbsp;expression 正则表达式<br />
&nbsp;flags&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 下列标志中的一个或多个 CASE_INSENSITIVE, UNICODE_CASE, MULTILINE, UNIX_LINES, DOTALL, and CANON_EQ<br />
&nbsp;<br />
Matcher matcher(CharSequence input)<br />
返回一个matcher对象，它可以用来在一个输入中定位模式匹配<br />
<br />
String[] split(CharSequence input)<br />
String[] split(CharSequence input, int limit)<br />
将输入字符串分离成记号，并由pattern来指定分隔符的形式。返回记号数组。分隔符并不是记号的一部分。<br />
参数:<br />
input 分离成记号的字符串<br />
limit 生成的最大字符串数。<br />
<hr style="width: 100%; height: 2px" />
<span style="font-weight: bold" twffan="done">&nbsp;类</span><br />
<hr style="width: 100%; height: 2px" />
java.util.regex.Matcher 1.4<br />
<hr style="width: 100%; height: 2px" />
<span style="font-weight: bold" twffan="done">方法</span><br />
<hr style="width: 100%; height: 2px" />
boolean matches()<br />
返回输入是否与模式匹配<br />
<br />
boolean lookingAt()<br />
如果输入的起始匹配模式则返回True<br />
<br />
boolean find()<br />
boolean find(int start)<br />
尝试查找下一个匹配，并在找到匹配时返回True<br />
参数:<br />
&nbsp;start&nbsp; 开始搜索的索引<br />
&nbsp;<br />
int start()<br />
int end()<br />
返回当前匹配的起始位置和结尾后位置<br />
<br />
String group()<br />
返回当前匹配<br />
<br />
int groupCount()<br />
返回输入模式中的分组数<br />
<br />
int start(int groupIndex)<br />
int end(int groupIndex)<br />
返回一个给定分组当前匹配中的起始位置和结尾后位置<br />
参数:<br />
&nbsp;groupIndex分组索引（从1开始），0表示整个匹配<br />
<br />
String group(int groupIndex)<br />
返回匹配一个给定分组的字符串<br />
参数:<br />
&nbsp;groupIndex<br />
&nbsp;分组索引（从1开始），0表示整个匹配<br />
<br />
String replaceAll(String replacement)<br />
String replaceFirst(String replacement)<br />
返回从matcher输入得到的字符串，但已经用替换表达式替换所有或第一个匹配<br />
参数:<br />
&nbsp;replacement 替换字符串 <br />
<br />
Matcher reset()<br />
Matcher reset(CharSequence input)<br />
复位mather状态。 <br /><img src ="http://www.blogjava.net/etlan/aggbug/193452.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/etlan/" target="_blank">张秀兰</a> 2008-04-16 15:13 <a href="http://www.blogjava.net/etlan/archive/2008/04/16/193452.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>asp access数据库预处理方法</title><link>http://www.blogjava.net/etlan/archive/2007/12/13/167498.html</link><dc:creator>张秀兰</dc:creator><author>张秀兰</author><pubDate>Thu, 13 Dec 2007 06:24:00 GMT</pubDate><guid>http://www.blogjava.net/etlan/archive/2007/12/13/167498.html</guid><wfw:comment>http://www.blogjava.net/etlan/comments/167498.html</wfw:comment><comments>http://www.blogjava.net/etlan/archive/2007/12/13/167498.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/etlan/comments/commentRss/167498.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/etlan/services/trackbacks/167498.html</trackback:ping><description><![CDATA[这两天小弟提了个Bug，也是在网上找了些资料，才搞定了它，顺便在此作个笔记<br />
<br />
重点作解析对象：<br />
Sub SaveAdd()<br />
cm.CommandText&nbsp;&nbsp; =&nbsp;&nbsp; "INSERT INTO [xm_news] (n_title,n_pic,n_Info,n_Atime) VALUES(?,?,?,?)"<br />
cm.Prepared&nbsp;&nbsp; =&nbsp;&nbsp; True<br />
cm.Parameters.Append&nbsp;&nbsp; cm.CreateParameter("n_title",200, ,255)<br />
cm.Parameters.Append&nbsp;&nbsp; cm.CreateParameter("n_pic",200, ,255)<br />
cm.Parameters.Append&nbsp;&nbsp; cm.CreateParameter("n_Info",200,&nbsp; ,-1)<br />
cm.Parameters.Append&nbsp;&nbsp; cm.CreateParameter("n_Atime",200, ,255)<br />
cm("n_title")=Request.Form("title")<br />
cm("n_pic")=Request.Form("defaultpic")<br />
cm("n_Info")=Request.Form("info")<br />
cm("n_Atime")=now<br />
cm.Execute<br />
&nbsp;Response.Write ("&lt;script&gt;alert('添加成功!');location='?'&lt;/script&gt;")<br />
End Sub<br />
<br />
<span style="color: #ff0000" twffan="done"><strong>cm.Parameters.Append&nbsp;&nbsp; cm.CreateParameter("n_Info",200,&nbsp; ,-1)<br />
</strong></span>'得是-1<br />
<br />
<p>&lt;!--#include file="inc.asp"--&gt;<br />
&lt;html&gt;<br />
&lt;head&gt;<br />
&lt;meta http-equiv="Content-Type" content="text/html; charset=gb2312"&gt;<br />
&lt;title&gt;后台产品管理&lt;/title&gt;<br />
&lt;STYLE type=text/css&gt;BODY {<br />
&nbsp;BACKGROUND-COLOR: #ffffff<br />
}<br />
.toptable1 {<br />
&nbsp;COLOR: #000000; BACKGROUND-COLOR: #d2d6dc<br />
}<br />
.toptable2 {<br />
&nbsp;BACKGROUND-IMAGE: url(images/topdi.gif); COLOR: #000000<br />
}<br />
.banner {<br />
&nbsp;BACKGROUND-IMAGE: url(images/topdi.gif); COLOR: #7089a9; HEIGHT: 25px<br />
}<br />
.tablecolor {<br />
&nbsp;WIDTH: 98%; WORD-BREAK: break-all; BACKGROUND-COLOR: #888888<br />
}<br />
.tablebody {<br />
&nbsp;BACKGROUND-COLOR: #ffffff<br />
}<br />
TD {<br />
&nbsp;FONT-SIZE: 12px; COLOR: #000000<br />
}<br />
INPUT {<br />
&nbsp;BORDER-RIGHT: #333333 1px solid; BORDER-TOP: #333333 1px solid; FONT-SIZE: 9pt; BACKGROUND: url(images/input.gif) #ffffff; BORDER-LEFT: #333333 1px solid; COLOR: #000000; BORDER-BOTTOM: #333333 1px solid; FONT-FAMILY: verdana<br />
}<br />
A:link {<br />
&nbsp;COLOR: #666666; TEXT-DECORATION: none<br />
}<br />
A:active {<br />
&nbsp;COLOR: #666666; TEXT-DECORATION: none<br />
}<br />
A:visited {<br />
&nbsp;COLOR: #666666; TEXT-DECORATION: none<br />
}<br />
A:hover {<br />
&nbsp;COLOR: #339900; TEXT-DECORATION: underline<br />
}<br />
A.a:link {<br />
&nbsp;COLOR: #ea7500; TEXT-DECORATION: none<br />
}<br />
A.a:visited {<br />
&nbsp;COLOR: #ea7500; TEXT-DECORATION: none<br />
}<br />
A.a:active {<br />
&nbsp;COLOR: #ea7500; TEXT-DECORATION: none<br />
}<br />
A.a:hover {<br />
&nbsp;COLOR: #ea7500; TEXT-DECORATION: underline<br />
}<br />
&lt;/STYLE&gt;<br />
&lt;/head&gt;<br />
&lt;body&gt;<br />
&lt;%<br />
Call Checkadmin()<br />
ID=CheckNumeric(Request("ID"))<br />
Action = Trim(Request.QueryString("Action"))</p>
<p>DatabasePath="../database/database.mdb"<br />
Set Conn = Server.Createobject("Adodb.Connection")<br />
Conn.Open "Provider=Microsoft.Jet.Oledb.4.0;Data Source="&amp;Server.Mappath(DatabasePath)<br />
'Call OpenDatabase()<br />
Set&nbsp;&nbsp; cm=&nbsp;&nbsp; Server.CreateObject("ADODB.Command")<br />
Set&nbsp;&nbsp; cm.ActiveConnection&nbsp;&nbsp; =&nbsp;&nbsp; Conn<br />
Select Case Action<br />
&nbsp;Case "Edit"<br />
&nbsp;&nbsp;Call Edit()<br />
&nbsp;Case "SaveAdd"<br />
&nbsp;&nbsp;Call SaveADD()<br />
&nbsp;Case "Add"<br />
&nbsp;&nbsp;Call Add()<br />
&nbsp;Case "SaveEdit"<br />
&nbsp;&nbsp;Call Saveedit()<br />
&nbsp;Case "Del"<br />
&nbsp;&nbsp;Call Del()<br />
&nbsp;Case Else<br />
&nbsp;&nbsp;call Normal()<br />
End Select<br />
call CloseDatabase()</p>
<p>Sub Edit()<br />
Set Rs = Conn.Execute("SELECT * From xm_news Where n_Id ="&amp;id&amp;"")<br />
%&gt;&lt;form action="?Action=SaveEdit&amp;ID=&lt;%=RS("n_ID")%&gt;" method="post"&nbsp; name="form1" &gt;</p>
<p>&nbsp; &lt;table width="100%"&nbsp; border="0" cellpadding="0" cellspacing="1" bgcolor="#95DDFF"&gt;<br />
&nbsp;&nbsp;&nbsp; &lt;tr bgcolor="#ECF4FB"&gt; <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;td width="14%" height="30"&gt;新闻标题：&lt;/td&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;td&gt; <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;input name="title" type="text" id="title" value="&lt;%=RS("n_title")%&gt;" size="50"&gt;&lt;/td&gt;<br />
&nbsp; &lt;/tr&gt;</p>
<p>&nbsp;&nbsp;&nbsp; &lt;tr bgcolor="#ECF4FB"&gt; <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;td height="30"&gt;新闻图片：&lt;/td&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;td&gt; <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;INPUT name="DefaultPic" type="text" id="DefaultPic" value="&lt;%=rs("n_pic")%&gt;"&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;br&gt; &lt;IFRAME ID="DefaultPic1" SRC="upload.asp?t=1" FRAMEBORDER="0" SCROLLING="no" WIDTH="500" HEIGHT="30"&gt;&lt;/IFRAME&gt;&lt;/td&gt;<br />
&nbsp; &lt;/tr&gt;<br />
&nbsp; &lt;tr&gt; </p>
<p>&nbsp;&nbsp;&nbsp; &lt;tr bgcolor="#ECF4FB"&gt; <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;td height="30"&gt;新闻描述：&lt;/td&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;td&gt; <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;textarea name="info" cols="50" id="textarea"&gt;&lt;%=rs("n_info")%&gt;&lt;/textarea&gt; <br />
&nbsp; &lt;/tr&gt;<br />
&nbsp;&nbsp;&nbsp; &lt;tr bgcolor="#ECF4FB"&gt; <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;td&gt;&amp;nbsp;&lt;/td&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;td&gt; <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;input type="submit" name="bottom2" value="提交" &gt; &lt;input type="reset" name="Submit2" value="重置"&gt;&lt;/td&gt;<br />
&nbsp; &lt;/tr&gt;<br />
&lt;/table&gt;&lt;/form&gt;<br />
&lt;%<br />
End Sub</p>
<p>Sub SAVEEdit()<br />
cm.CommandText&nbsp;&nbsp; =&nbsp;&nbsp; "Update xm_news Set n_title= ?,n_pic= ?, n_info=? Where n_Id="&amp;id&amp;""<br />
cm.Prepared&nbsp;&nbsp; =&nbsp;&nbsp; True<br />
cm.Parameters.Append&nbsp;&nbsp; cm.CreateParameter("n_title",200, ,255)<br />
cm.Parameters.Append&nbsp;&nbsp; cm.CreateParameter("n_pic",200, ,255)<br />
cm.Parameters.Append&nbsp;&nbsp; cm.CreateParameter("n_Info",200,&nbsp; ,-1)<br />
cm("n_title")=Request.Form("title")<br />
cm("n_pic")=Request.Form("Defaultpic")<br />
cm("n_Info")=Request.Form("info")<br />
cm.Execute</p>
<p>&nbsp;'Conn.Execute("Update xm_news Set n_title='"&amp;Request.Form("title")&amp;"',n_pic='"&amp;Request.Form("Defaultpic")&amp;"',n_info='"&amp;Request.Form("info")&amp;"' Where n_Id="&amp;id&amp;"")<br />
&nbsp;Response.Write ("&lt;script&gt;alert('修改成功!');location='?'&lt;/script&gt;")<br />
End Sub</p>
<p>Sub SaveAdd()<br />
cm.CommandText&nbsp;&nbsp; =&nbsp;&nbsp; "INSERT INTO [xm_news] (n_title,n_pic,n_Info,n_Atime) VALUES(?,?,?,?)"<br />
cm.Prepared&nbsp;&nbsp; =&nbsp;&nbsp; True<br />
cm.Parameters.Append&nbsp;&nbsp; cm.CreateParameter("n_title",200, ,255)<br />
cm.Parameters.Append&nbsp;&nbsp; cm.CreateParameter("n_pic",200, ,255)<br />
cm.Parameters.Append&nbsp;&nbsp; cm.CreateParameter("n_Info",200,&nbsp; ,-1)<br />
cm.Parameters.Append&nbsp;&nbsp; cm.CreateParameter("n_Atime",200, ,255)<br />
cm("n_title")=Request.Form("title")<br />
cm("n_pic")=Request.Form("defaultpic")<br />
cm("n_Info")=Request.Form("info")<br />
cm("n_Atime")=now<br />
cm.Execute<br />
&nbsp;Response.Write ("&lt;script&gt;alert('添加成功!');location='?'&lt;/script&gt;")<br />
End Sub</p>
<p>Sub Del()<br />
&nbsp;Conn.Execute("Delete from xm_news where n_Id ="&amp;ID&amp;"")<br />
&nbsp;Response.Write ("&lt;script&gt;alert('删除成功!');location='?'&lt;/script&gt;")<br />
End Sub</p>
<p>&nbsp;</p>
<p><br />
Sub Add()<br />
%&gt;<br />
&lt;form action="?Action=SaveAdd" method="post"&nbsp; name="form1" &gt;<br />
&nbsp; &lt;table width="100%"&nbsp; border="0" cellpadding="0" cellspacing="1" bgcolor="#95DDFF"&gt;<br />
&nbsp;&nbsp;&nbsp; &lt;tr bgcolor="#ECF4FB"&gt; <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;td width="14%" height="30"&gt;新闻标题：&lt;/td&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;td&gt; <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;input name="title" type="text" id="title" size="50" &gt;&lt;/td&gt;<br />
&nbsp;&nbsp;&nbsp; &lt;/tr&gt;<br />
&nbsp;&nbsp;&nbsp; &lt;tr bgcolor="#ECF4FB"&gt; <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;td height="30"&gt;新闻图片test：&lt;/td&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;td&gt; <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;INPUT name="DefaultPic" type="text" id="DefaultPic"&gt; &lt;br&gt; &lt;IFRAME ID="DefaultPic1" SRC="upload.asp?t=1" FRAMEBORDER="0" SCROLLING="no" WIDTH="500" HEIGHT="30"&gt;&lt;/IFRAME&gt;&lt;/td&gt;<br />
&nbsp;&nbsp;&nbsp; &lt;/tr&gt;<br />
&nbsp;&nbsp;&nbsp; &lt;tr&gt; <br />
&nbsp;&nbsp;&nbsp; &lt;tr bgcolor="#ECF4FB"&gt; <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;td height="30"&gt;新闻描述：&lt;/td&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;td&gt; <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;textarea name="info" cols="50" id="info"&gt;&lt;/textarea&gt; <br />
&nbsp;&nbsp;&nbsp; &lt;/tr&gt;<br />
&nbsp;&nbsp;&nbsp; &lt;tr bgcolor="#ECF4FB"&gt; <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;td&gt;&amp;nbsp;&lt;/td&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;td&gt; <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;input type="submit" name="bottom" value="提交" &gt; &lt;input type="reset" name="Submit" value="重置"&gt;&lt;/td&gt;<br />
&nbsp;&nbsp;&nbsp; &lt;/tr&gt;<br />
&nbsp; &lt;/table&gt;<br />
&lt;/form&gt;<br />
&lt;%<br />
End Sub</p>
<p>sub normal%&gt;</p>
<p>&lt;table width="100%" border="0" cellpadding="2" cellspacing="1" bgcolor="#95DDFF"&gt;<br />
&nbsp; &lt;tr bgcolor="#ECF4FB"&gt; <br />
&nbsp;&nbsp;&nbsp; &lt;td width="187" bgcolor="#ECF4FB"&gt;&lt;strong&gt;ID&lt;/strong&gt;&lt;/td&gt;<br />
&nbsp;&nbsp;&nbsp; &lt;td width="294" bgcolor="#ECF4FB"&gt;&lt;strong&gt;标题&lt;/strong&gt;&lt;/td&gt;<br />
&nbsp;&nbsp;&nbsp; &lt;td width="279" bgcolor="#ECF4FB"&gt;&lt;strong&gt;编辑&lt;/strong&gt;&lt;/td&gt;<br />
&nbsp; &lt;/tr&gt;<br />
&nbsp;&nbsp; &lt;%<br />
PageNo=CheckNumeric(Request("pageno"))<br />
Sql="select n_id,n_title from xm_news order by n_id desc"<br />
set rs=server.CreateObject("adodb.recordset")<br />
rs.open sql,conn,1,1<br />
Pasz=12</p>
<p>Total=INT(rs.RecordCount\Pasz+1)<br />
rs.PageSize=Cint(Pasz)</p>
<p>if pageno&lt;1 or PageNo=""&nbsp; then<br />
&nbsp;pageno=1<br />
end if</p>
<p>if pageno &gt; Total then<br />
&nbsp;pageno=Total<br />
end if</p>
<p>rs.AbsolutePage=pageno<br />
position=rs.PageSize*pageno<br />
pagebegin=position-rs.PageSize+1</p>
<p>if position&lt;rs.RecordCount then<br />
&nbsp;pagend=position<br />
else<br />
&nbsp;pagend=rs.RecordCount<br />
end if</p>
<p>rs.AbsolutePosition=pagebegin<br />
for i =pagebegin to pagend<br />
%&gt;<br />
&nbsp; &lt;tr bgcolor="#ECF4FB"&gt; <br />
&nbsp;&nbsp;&nbsp; &lt;td&gt;&amp;nbsp;&lt;%=rs(0)%&gt;&lt;/td&gt;<br />
&nbsp;&nbsp;&nbsp; &lt;td&gt;&amp;nbsp;&lt;%=rs(1)%&gt;&lt;/td&gt;<br />
&nbsp;&nbsp;&nbsp; &lt;td&gt;&amp;nbsp;&lt;a href="?Action=Edit&amp;ID=&lt;%=RS(0)%&gt;"&gt;编辑&lt;/a&gt;|&lt;a href="?Action=Del&amp;ID=&lt;%=RS(0)%&gt;"&gt;删除&lt;/a&gt;&lt;/td&gt;<br />
&nbsp; &lt;/tr&gt;<br />
&nbsp; &lt;%<br />
rs.movenext<br />
next<br />
rs.close<br />
set rs=nothing<br />
%&gt;<br />
&lt;/table&gt;<br />
&lt;table align=center&gt;<br />
&lt;tr&gt;<br />
&lt;td align=right style="border:0px"&gt;&lt;a href="?pageno=&lt;%=pageno-1%&gt;"&gt;&lt;br&gt;[上一页]&lt;/a&gt;&lt;/td&gt;<br />
&lt;td align=left style="border:0px"&gt;&lt;a href="?pageno=&lt;%=pageno+1%&gt;"&gt;&lt;br&gt;[下一页]&lt;/a&gt;&lt;/td&gt;<br />
&lt;/tr&gt;<br />
&lt;/table&gt;<br />
&lt;%end sub%&gt;<br />
&lt;/body&gt;<br />
&lt;/html&gt;</p><img src ="http://www.blogjava.net/etlan/aggbug/167498.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/etlan/" target="_blank">张秀兰</a> 2007-12-13 14:24 <a href="http://www.blogjava.net/etlan/archive/2007/12/13/167498.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>总结：如何查看对MYSQL操作的IP</title><link>http://www.blogjava.net/etlan/archive/2007/11/08/159023.html</link><dc:creator>张秀兰</dc:creator><author>张秀兰</author><pubDate>Thu, 08 Nov 2007 02:18:00 GMT</pubDate><guid>http://www.blogjava.net/etlan/archive/2007/11/08/159023.html</guid><wfw:comment>http://www.blogjava.net/etlan/comments/159023.html</wfw:comment><comments>http://www.blogjava.net/etlan/archive/2007/11/08/159023.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/etlan/comments/commentRss/159023.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/etlan/services/trackbacks/159023.html</trackback:ping><description><![CDATA[问题：<br />
&nbsp;&nbsp;&nbsp;&nbsp;<span class="bold" twffan="done">如何查看对MYSQL操作的IP！</span><br />
<br />
<div class="t_msgfont" id="message562637" twffan="done">我的是mysql5.0的，一般操作都通过phpmyadmin,来完成操作，但是最近有人反映数据库被无故删除，虽然有备份，问题不大，但我我想查看操作数据库的IP地址，好确定是，哪里的在人员在进行操作！请大虾们，指点下，麻烦写的具体点哦，偶是低低手，需要你们指教！<br />
<br />
<div class="t_msgfont" id="message562638" twffan="done">回复１：两个方法，一个是修改phpmyadmin,自己增加对做删除数据库操作的IP的记录，这个需要你会写PHP。 <br />
<br />
另一个就是你可以对应用phpmyadmin的网站打开access_log，然后分析这个日志，查找DROP DATABASE相关的IP。 <br />
<br />
不过我觉得如果数据被无端删除，你应该着手检查以下事情： <br />
1、确认主机是否安全 <br />
2、确认你所使用的phpmyadmin版本是否安全 <br />
3、确认你有没有对MySQL user赋予不当的权限 <br />
4、确认你MySQL的root账户是否安全 <br />
<br />
我觉得第三点的可能性大一点，比如你对MySQL user用户赋予了全局权限.<br />
<br />
回复２：<br />
<div class="t_msgfont" id="message562640" twffan="done">赋予一个用户对他数据库的全部权限并不会发生问题，全局权限是说授权的部分或全部root才有的权限，你赋予了他对一个库的全部权限并不包括DROP。 <br />
<br />
如果你使用的Apache，并且使用了VirtualHost，那就在你http-vhost.conf中VirtualHost的CustomLog所制定的位置。 <br />
如果你在httpd.conf中打开了全局的CustomLog，那你就在httpd.conf中查找相关位置，默认是/var/log/httpd-error.log</div>
<br />
</div>
<br />
总结：<br />
一般在/var/log/httpd下可查看对其操作IP<br />
如在0.140上，<br />
cd /var/log/httpd <br />
less access_log<br />
</div><img src ="http://www.blogjava.net/etlan/aggbug/159023.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/etlan/" target="_blank">张秀兰</a> 2007-11-08 10:18 <a href="http://www.blogjava.net/etlan/archive/2007/11/08/159023.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>转：Eclipse插件大全(介绍及下载)</title><link>http://www.blogjava.net/etlan/archive/2007/10/29/156714.html</link><dc:creator>张秀兰</dc:creator><author>张秀兰</author><pubDate>Mon, 29 Oct 2007 08:18:00 GMT</pubDate><guid>http://www.blogjava.net/etlan/archive/2007/10/29/156714.html</guid><wfw:comment>http://www.blogjava.net/etlan/comments/156714.html</wfw:comment><comments>http://www.blogjava.net/etlan/archive/2007/10/29/156714.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/etlan/comments/commentRss/156714.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/etlan/services/trackbacks/156714.html</trackback:ping><description><![CDATA[【IT168 技术文档】Eclipse及其插件下载网址大全 <br />
1 Eclipse下载 <br />
EMF,GEF - Graphical Editor Framework,UML2,VE - Visual Editor都在这里下载 <br />
http://www.eclipse.org/downloads/index.php <br />
2 lomboz J2EE插件,开发JSP,EJB <br />
http://forge.objectweb.org/projects/lomboz <br />
3 MyEclipse J2EE开发插件，支持SERVLET/JSP/EJB/数据库操纵等 <br />
http://www.myeclipseide.com <br />
4 Properties Editor 编辑java的属性文件，并可以自动存盘为Unicode格式 <br />
http://propedit.sourceforge.jp/index_en.html <br />
5 Colorer Take 为上百种类型的文件按语法着色 <br />
http://colorer.sourceforge.net/ <br />
6 XMLBuddy 编辑xml文件 <br />
http://www.xmlbuddy.com <br />
7 Code Folding 加入多种代码折叠功能（比eclipse自带的更多） <br />
http://www.coffee-bytes.com/servlet/PlatformSupport <br />
8 Easy Explorer 从eclipse中访问选定文件、目录所在的文件夹 <br />
http://easystruts.sourceforge.net/ <br />
9 Fat Jar 打包插件，可以方便的完成各种打包任务，可以包含外部的包等 <br />
http://fjep.sourceforge.net/ <br />
10 RegEx Test 测试正则表达式 <br />
http://brosinski.com/stephan/archives/000028.php <br />
11 JasperAssistant 报表插件(要钱的哦～) <br />
http://www.jasperassistant.com/ <br />
12 Jigloo GUI Builder JAVA的GUI编辑插件 <br />
http://cloudgarden.com/jigloo/ <br />
13 Profiler 性能跟踪、测量工具，能跟踪、测量B/S程序 <br />
http://sourceforge.net/projects/eclipsecolorer/ <br />
14 AdvanQas 提供对if/else等条件语句的提示和快捷帮助(自动更改结构等) <br />
http://eclipsecolorer.sourceforge.net/advanqas/index.html <br />
15 Log4E Log4j插件，提供各种和Log4j相关的任务，如为方法、类添加一个logger等 <br />
http://log4e.jayefem.de/index.php/Main_Page <br />
16 VSSPlugin VSS插件 <br />
http://sourceforge.net/projects/vssplugin <br />
17 Implementors 提供跳转到一个方法的实现类，而不是接口的功能（实用!） <br />
http://eclipse-tools.sourceforge.net/implementors/ <br />
18 Call Hierarchy 显示一个方法的调用层次（被哪些方法调，调了哪些方法） <br />
http://eclipse-tools.sourceforge.net/call-hierarchy/index.html <br />
19 EclipseTidy 检查和格式化HTML/XML文件 <br />
http://eclipsetidy.sourceforge.net/ <br />
20 Checkclipse 检查代码的风格、写法是否符合规范 <br />
http://www.mvmsoft.de/content/plugins/checkclipse/checkclipse.htm <br />
21 Hibernate Synchronizer Hibernate插件，自动映射等 <br />
http://www.binamics.com/hibernatesync/ <br />
22 VeloEclipse Velocity插件 <br />
http://propsorter.sourceforge.net/ <br />
<br />
23 EditorList 方便的列出所有打开的Editor <br />
http://editorlist.sourceforge.net/ <br />
<br />
24 MemoryManager <a title="内存" style="color: #000000" href="http://product.it168.com/list/b/0205_1.shtml" target="_blank">内存</a>占用率的监视 <br />
http://cloudgarden.com/memorymanager/ <br />
<br />
25 swt-designer java的GUI插件 <br />
http://www.swt-designer.com/ <br />
<br />
26 TomcatPlugin 支持Tomcat插件 <br />
http://www.sysdeo.com/eclipse/tomcatPlugin.html <br />
<br />
27 XML Viewer <br />
http://tabaquismo.freehosting.net/ignacio/eclipse/xmlview/index.html <br />
<br />
28 quantum 数据库插件 <br />
http://quantum.sourceforge.net/ <br />
<br />
29 Dbedit 数据库插件 <br />
http://sourceforge.net/projects/dbedit <br />
<br />
30 clay.core 可视化的数据库插件 <br />
http://www.azzurri.jp/en/software/index.jsp <br />
http://www.azzurri.jp/eclipse/plugins <br />
<br />
31 hiberclipse hibernate插件 <br />
http://hiberclipse.sourceforge.net <br />
http://www.binamics.com/hibernatesync <br />
<br />
32 struts-console Struts插件 <br />
http://www.jamesholmes.com/struts/console/ <br />
<br />
33 easystruts Struts插件 <br />
http://easystruts.sourceforge.net <br />
<br />
34 veloedit Velocity插件 <br />
http://veloedit.sourceforge.net/ <br />
<br />
35 jalopy 代码整理插件 <br />
http://jalopy.sourceforge.net/ <br />
<br />
36 JDepend 包关系分析 <br />
http://andrei.gmxhome.de/jdepend4eclipse/links.html <br />
<br />
37 Spring IDE Spring插件 <br />
http://springide-eclip.sourceforge.net/updatesite/ <br />
<br />
38 doclipse 可以产生xdoclet 的代码提示 <br />
http://beust.com/doclipse/ <br />
39 SQLExplorer,在Eclipse 中连接各种数据库进行操作使用 <br />
http://dev2dev.bea.com.cn/bbs/thread.jspa?forumID=124&amp;threadID=31124<img src ="http://www.blogjava.net/etlan/aggbug/156714.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/etlan/" target="_blank">张秀兰</a> 2007-10-29 16:18 <a href="http://www.blogjava.net/etlan/archive/2007/10/29/156714.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>mysql查看表结构命令</title><link>http://www.blogjava.net/etlan/archive/2007/07/12/129794.html</link><dc:creator>张秀兰</dc:creator><author>张秀兰</author><pubDate>Thu, 12 Jul 2007 04:02:00 GMT</pubDate><guid>http://www.blogjava.net/etlan/archive/2007/07/12/129794.html</guid><wfw:comment>http://www.blogjava.net/etlan/comments/129794.html</wfw:comment><comments>http://www.blogjava.net/etlan/archive/2007/07/12/129794.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/etlan/comments/commentRss/129794.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/etlan/services/trackbacks/129794.html</trackback:ping><description><![CDATA[<span class="javascript" id="text3772126" style="font-size: 12px" twffan="done"><font face="Verdana">mysql查看表结构命令，如下:<br />
<br />
desc 表名;<br />
show columns from 表名;<br />
<span class="javascript" id="text3772858" style="font-size: 12px" twffan="done">describe 表名;<br />
show create table 表名;<br />
<br />
use information_schema<br />
select * from columns where table_name='表名';<br />
<br />
顺便记下：<br />
show databases;<br />
use 数据库名;<br />
show tables;<br />
<br />
<br />
<br />
原有一unique索引AK_PAS_Name(PAC_Name)在表tb_webparamcounter中，<br />
执行以下sql修改索引<br />
alter table tb_webparamcounter drop index AK_PAS_Name;<br />
alter table tb_webparamcounter add UNIQUE AK_PAS_Name(PC_ID,PAC_Name);<br />
<br />
若发现索引的逻辑不对，还需要再加一个字段进去，执行<br />
alter table tb_webparamcounter drop index AK_PAS_Name;<br />
alter table tb_webparamcounter add UNIQUE AK_PAS_Name(PC_ID,PAC_Name,PAC_Value);<br />
注意：这时的PC_ID,PAC_Name,PAC_Value三个字段不是FOREIGN KEY<br />
否则必需先drop FOREIGN KEY，再重做上一步才行<br />
<br />
顺便提下oracle<br />
select * from v$database;<br />
select * from all_users;<br />
select * from user_tables;<br />
</span></font></span><img src ="http://www.blogjava.net/etlan/aggbug/129794.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/etlan/" target="_blank">张秀兰</a> 2007-07-12 12:02 <a href="http://www.blogjava.net/etlan/archive/2007/07/12/129794.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Eclipse中的快捷键</title><link>http://www.blogjava.net/etlan/archive/2007/06/14/124310.html</link><dc:creator>张秀兰</dc:creator><author>张秀兰</author><pubDate>Thu, 14 Jun 2007 06:11:00 GMT</pubDate><guid>http://www.blogjava.net/etlan/archive/2007/06/14/124310.html</guid><wfw:comment>http://www.blogjava.net/etlan/comments/124310.html</wfw:comment><comments>http://www.blogjava.net/etlan/archive/2007/06/14/124310.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/etlan/comments/commentRss/124310.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/etlan/services/trackbacks/124310.html</trackback:ping><description><![CDATA[<h4>Eclipse中的快捷键</h4>
<!--#homemin_text_begin//-->
<div class=tpc_content twffan="done">本文档从Eclipse软件上整理，是列出了标准的快捷键，未列出Emacs快捷键。 <br><br><span style="COLOR: #ff0000" twffan="done"><font face=Tahoma>&lt;如果忘记如下快捷键，可以使用Eclipse3.1中查看快捷键的使用方式：&gt;</font></span>CTRL+SHIFT+L <br><br>编辑 <br>作用域 功能 快捷键 <br>全局 查找并替换 Ctrl+F <br>文本编辑器 查找上一个 Ctrl+Shift+K <br>文本编辑器 查找下一个 Ctrl+K <br>全局 撤销 Ctrl+Z <br>全局 复制 Ctrl+C <br>全局 恢复上一个选择 Alt+Shift+&#8595; <br>全局 剪切 Ctrl+X <br>全局 快速修正 Ctrl1+1 <br>全局 内容辅助 Alt+/ <br>全局 全部选中 Ctrl+A <br>全局 删除 Delete <br>全局 上下文信息 Alt+？ <br><br><br>Java编辑器 显示工具提示描述 F2 <br>Java编辑器 选择封装元素 Alt+Shift+&#8593; <br>Java编辑器 选择上一个元素 Alt+Shift+&#8592; <br>Java编辑器 选择下一个元素 Alt+Shift+&#8594; <br>文本编辑器 增量查找 Ctrl+J <br>文本编辑器 增量逆向查找 Ctrl+Shift+J <br>全局 粘贴 Ctrl+V <br>全局 重做 Ctrl+Y <br><br><br>查看 <br>作用域 功能 快捷键 <br>全局 放大 Ctrl+= <br>全局 缩小 Ctrl+- <br><br><br>窗口 <br>作用域 功能 快捷键 <br>全局 激活编辑器 F12 <br>全局 切换编辑器 Ctrl+Shift+W <br>全局 上一个编辑器 Ctrl+Shift+F6 <br>全局 上一个视图 Ctrl+Shift+F7 <br>全局 上一个透视图 Ctrl+Shift+F8 <br>全局 下一个编辑器 Ctrl+F6 <br>全局 下一个视图 Ctrl+F7 <br>全局 下一个透视图 Ctrl+F8 <br>文本编辑器 显示标尺上下文菜单 Ctrl+W <br>全局 显示视图菜单 Ctrl+F10 <br>全局 显示系统菜单 Alt+- <br><br><br>导航 <br>作用域 功能 快捷键 <br>Java编辑器 打开结构 Ctrl+F3 <br>全局 打开类型 Ctrl+Shift+T <br>全局 打开类型层次结构 F4 <br>全局 打开声明 F3 <br>全局 打开外部javadoc Shift+F2 <br>全局 打开资源 Ctrl+Shift+R <br>全局 后退历史记录 Alt+&#8592; <br>全局 前进历史记录 Alt+&#8594; <br>全局 上一个 Ctrl+, <br>全局 下一个 Ctrl+. <br>Java编辑器 显示大纲 Ctrl+O <br>全局 在层次结构中打开类型 Ctrl+Shift+H <br>全局 转至匹配的括号 Ctrl+Shift+P <br>全局 转至上一个编辑位置 Ctrl+Q <br>Java编辑器 转至上一个成员 Ctrl+Shift+&#8593; <br>Java编辑器 转至下一个成员 Ctrl+Shift+&#8595; <br>文本编辑器 转至行 Ctrl+L <br><br><br>搜索 <br>作用域 功能 快捷键 <br>全局 出现在文件中 Ctrl+Shift+U <br>全局 打开搜索对话框 Ctrl+H <br>全局 工作区中的声明 Ctrl+G <br>全局 工作区中的引用 Ctrl+Shift+G <br><br><br>文本编辑 <br>作用域 功能 快捷键 <br>文本编辑器 改写切换 Insert <br>文本编辑器 上滚行 Ctrl+&#8593; <br>文本编辑器 下滚行 Ctrl+&#8595; <br><br><br>文件 <br>作用域 功能 快捷键 <br>全局 保存 Ctrl+S <br>全局 打印 Ctrl+P <br>全局 关闭 Ctrl+F4 <br>全局 全部保存 Ctrl+Shift+S <br>全局 全部关闭 Ctrl+Shift+F4 <br>全局 属性 Alt+Enter <br>全局 新建 Ctrl+N <br><br><br>项目 <br>作用域 功能 快捷键 <br>全局 全部构建 Ctrl+B <br><br><br>源代码 <br>作用域 功能 快捷键 <br>Java编辑器 格式化 Ctrl+Shift+F <br>Java编辑器 取消注释 Ctrl+\ <br>Java编辑器 注释 Ctrl+/ <br>Java编辑器 添加导入 Ctrl+Shift+M <br>Java编辑器 组织导入 Ctrl+Shift+O <br><br><br><br>运行 <br>作用域 功能 快捷键 <br>全局 单步返回 F7 <br>全局 单步跳过 F6 <br>全局 单步跳入 F5 <br>全局 单步跳入选择 Ctrl+F5 <br>全局 调试上次启动 F11 <br>全局 继续 F8 <br>全局 使用过滤器单步执行 Shift+F5 <br>全局 添加/去除断点 Ctrl+Shift+B <br>全局 显示 Ctrl+D <br>全局 运行上次启动 Ctrl+F11 <br>全局 运行至行 Ctrl+R <br>全局 执行 Ctrl+U <br><br><br>重构 <br>作用域 功能 快捷键 <br>全局 撤销重构 Alt+Shift+Z <br>全局 抽取方法 Alt+Shift+M <br>全局 抽取局部变量 Alt+Shift+L <br>全局 内联 Alt+Shift+I <br>全局 移动 Alt+Shift+V <br>全局 重命名 Alt+Shift+R <br>全局 重做 Alt+Shift+Y</div>
<!--#homemin_text_end//--><img src ="http://www.blogjava.net/etlan/aggbug/124310.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/etlan/" target="_blank">张秀兰</a> 2007-06-14 14:11 <a href="http://www.blogjava.net/etlan/archive/2007/06/14/124310.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>I. 第一章 目录及文件操作命令</title><link>http://www.blogjava.net/etlan/archive/2007/06/14/124247.html</link><dc:creator>张秀兰</dc:creator><author>张秀兰</author><pubDate>Thu, 14 Jun 2007 02:12:00 GMT</pubDate><guid>http://www.blogjava.net/etlan/archive/2007/06/14/124247.html</guid><wfw:comment>http://www.blogjava.net/etlan/comments/124247.html</wfw:comment><comments>http://www.blogjava.net/etlan/archive/2007/06/14/124247.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/etlan/comments/commentRss/124247.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/etlan/services/trackbacks/124247.html</trackback:ping><description><![CDATA[I. 第一章 目录及文件操作命令 &nbsp; <br>&nbsp; A. 1.1 &nbsp; ls &nbsp; <br>&nbsp; &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [语法]： &nbsp; ls &nbsp; &nbsp; [-RadCxmlnogrtucpFbqisf1] &nbsp; &nbsp; &nbsp; [目录或文件......] &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [说明]： &nbsp; ls &nbsp; 命令列出指定目录下的文件，缺省目录为当前目录 &nbsp; ./，缺省输出顺序为纵向按字符顺序排列。 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -R &nbsp; &nbsp; 递归地列出每个子目录的内容 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -a &nbsp; &nbsp; 列出所有文件，包括第一个字符为&#8220;.&#8221;的隐藏文件 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -d &nbsp; &nbsp; 若后面参数是目录，则只列出目录名而不列出目录内容，常与-l选项连 &nbsp; <br>&nbsp; &nbsp; 用以显示目录状态。 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -C &nbsp; &nbsp; 输出时多列显示 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -x &nbsp; &nbsp; 横向按字符顺序排列 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -m &nbsp; &nbsp; 输出按流式格式横向排列，文件名之间用逗号(，)分隔 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -l &nbsp; &nbsp; 长列表输出，显示文件详细信息，每行一个文件，从左至右依次是： &nbsp; <br>&nbsp; 文件存取模式 &nbsp; &nbsp; 链接数 &nbsp; &nbsp; 文件主 &nbsp; &nbsp; 文件组 &nbsp; &nbsp; 文件字节数 &nbsp; &nbsp; &nbsp; 上次修改时间 &nbsp; <br>&nbsp; 其中文件存取模式用10个字母表示，从左至右的意义如下： &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 第一个字母表示文件种类，可以是以下几种情况： &nbsp; <br>&nbsp; d &nbsp; 为目录文件 &nbsp; <br>&nbsp; l &nbsp; 为链接 &nbsp; <br>&nbsp; b &nbsp; 为块文件 &nbsp; <br>&nbsp; c &nbsp; 为字符型文件 &nbsp; <br>&nbsp; p &nbsp; 为命名管道（FIFO) &nbsp; <br>&nbsp; - &nbsp; 为普通文件 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 后面9个字母分别表示文件主、同组用户、其他用户对文件的权力，用r表示可读，w &nbsp; 表示可写，x &nbsp; 表示可执行。如果是设备文件，则在文件字节数处显示：主设备 &nbsp; &nbsp; 从设备。 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -n &nbsp; &nbsp; &nbsp; &nbsp; 与-l选项相同，只是文件主用数字(即UID)显示，文件组用数字 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (即GID)表示 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -o &nbsp; &nbsp; &nbsp; &nbsp; 与-l选项相同，只是不显示文件组 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -g &nbsp; &nbsp; &nbsp; &nbsp; 与-l选项相同，只是不显示文件主 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -r &nbsp; &nbsp; &nbsp; &nbsp; 逆序排列 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -t &nbsp; &nbsp; &nbsp; 按时间顺序排列而非按名字 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -u &nbsp; &nbsp; &nbsp; 显示时间时使用上次访问时间而非上次修改时间 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -c &nbsp; &nbsp; &nbsp; 显示时间时使用上次修改i节点时间而非上次修改时间 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -p &nbsp; &nbsp; &nbsp; 若所列文件是目录文件，则在其后显示斜杠(/) &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -F &nbsp; &nbsp; &nbsp; 在目录文件后加&#8217;/&#8217;，在可执行文件后加&#8217;*&#8217; &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -b &nbsp; &nbsp; &nbsp; 文件名中若有非打印字符，则用八进制显示该字符 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -q &nbsp; &nbsp; &nbsp; 文件名中的打印字符用&#8217;?&#8217;表示 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -i &nbsp; &nbsp; &nbsp; &nbsp; 显示节点号 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -s &nbsp; &nbsp; &nbsp; &nbsp; 显示文件长度时使用块长度而非字节长度 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -f &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 将后面的参数解释为目录并列出其中的每一项 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -1 &nbsp; &nbsp; &nbsp; &nbsp; 每行仅列一项 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [例子]: &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; ls &nbsp; &nbsp; &nbsp; 列出当前目录下的文件 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ls &nbsp; -al &nbsp; &nbsp; /bin &nbsp; &nbsp; &nbsp; 以长列表的形式列出目录 &nbsp; /bin &nbsp; 下的所有文件，包括隐藏文件 &nbsp; <br>&nbsp; &nbsp; <br>&nbsp; B. 1.2 &nbsp; pwd &nbsp; <br>&nbsp; &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [语法]: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pwd &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [说明]： &nbsp; &nbsp; &nbsp; &nbsp; 本命令用于显示当前的工作目录 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [例子]: &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pwd &nbsp; &nbsp; &nbsp; &nbsp; 显示出当前的工作目录 &nbsp; <br>&nbsp; &nbsp; <br>&nbsp; &nbsp; <br>&nbsp; C. 1.3 &nbsp; cd &nbsp; <br>&nbsp; &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [语法]: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cd &nbsp; &nbsp; &nbsp; [目录] &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [说明]：本命令用于改变当前的工作目录，无参数时使用环境变量$HOME &nbsp; 作为其参数，$HOME &nbsp; 一般为注册时进入的路径。 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [例子]： &nbsp; &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cd &nbsp; &nbsp; &nbsp; 回到注册进入时的目录 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cd &nbsp; &nbsp; &nbsp; /tmp &nbsp; &nbsp; &nbsp; &nbsp; 进入 &nbsp; /tmp &nbsp; 目录 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cd &nbsp; &nbsp; ../ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 进入上级目录 &nbsp; <br>&nbsp; D. 1.4 &nbsp; mkdir &nbsp; <br>&nbsp; &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [语法]: &nbsp; &nbsp; &nbsp; mkdir &nbsp; [-m &nbsp; 模式] &nbsp; [-p] &nbsp; &nbsp; 目录名 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [说明]: &nbsp; &nbsp; 本命令用于建立目录，目录的存取模式由掩码（umask)决定，要求对其父目录具有写权限，目录的UID和GID为实际UID和GID &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -m &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 按指定存取模式建立目录 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -p &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 建立目录时建立其所有不存在的父目录 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [例子]: &nbsp; &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mkdir &nbsp; &nbsp; tmp &nbsp; &nbsp; &nbsp; &nbsp; 在当前目录下建立子目录 &nbsp; tmp &nbsp; &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mkdir &nbsp; &nbsp; -m &nbsp; 777 &nbsp; &nbsp; &nbsp; /tmp/abc &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 用所有用户可读可写可执行的存取模式 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 建立目录 &nbsp; /tmp/aaa &nbsp; ，存取模式参看命令 &nbsp; chmod &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mkdir &nbsp; &nbsp; -p &nbsp; /tmp/a/b/c &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 建立目录 &nbsp; /tmp/a/b/c &nbsp; ，若不存在目录 &nbsp; /tmp/a &nbsp; &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 及/tmp/a/b &nbsp; 则建立之 &nbsp; <br>&nbsp; &nbsp; <br>&nbsp; &nbsp; <br>&nbsp; E. 1.5 &nbsp; rmdir &nbsp; <br>&nbsp; &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [语法]: &nbsp; &nbsp; &nbsp; &nbsp; rmdir &nbsp; &nbsp; [-p] &nbsp; [-s] &nbsp; 目录名 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [说明]: &nbsp; &nbsp; &nbsp; &nbsp; 本命令用于删除目录 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -p &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 删除所有已经为空的父目录 &nbsp; <br>&nbsp; &nbsp; &nbsp; -s &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 当使用-p &nbsp; 选项时，出现错误不提示 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [例子]: &nbsp; &nbsp; &nbsp; &nbsp; <br>&nbsp; rmdir &nbsp; &nbsp; /tmp/abc &nbsp; &nbsp; &nbsp; 删除目录 &nbsp; /tmp/abc &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rmdir &nbsp; &nbsp; -p &nbsp; &nbsp; /tmp/a/b/c &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 删除目录 &nbsp; /tmp/a/b/c &nbsp; ，若目录 &nbsp; /tmp/a &nbsp; /b &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 及/tmp/a &nbsp; 空，则删除 &nbsp; <br>&nbsp; &nbsp; <br>&nbsp; &nbsp; <br>&nbsp; &nbsp; <br>&nbsp; F. 1.6 &nbsp; cat &nbsp; <br>&nbsp; &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [语法]: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cat &nbsp; [-u] &nbsp; [-s] &nbsp; [-v[-t] &nbsp; [-e]] &nbsp; 文件... &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [说明]: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 显示和连接一个或多个文件至标准输出 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -u &nbsp; &nbsp; &nbsp; &nbsp; 无缓冲的输出(缺省为有缓冲输出) &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -s &nbsp; &nbsp; &nbsp; &nbsp; 对不存在的文件不作提示 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -v &nbsp; &nbsp; &nbsp; &nbsp; 显示出文件中的非打印字符，控制字符显示成^n &nbsp; ，n为八进制数字， &nbsp; <br>&nbsp; 其他非打印字符显示成M-x &nbsp; ， &nbsp; x &nbsp; 为该字符低7位的8进制数值 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -t &nbsp; &nbsp; &nbsp; &nbsp; 在使用-v &nbsp; 选项时，将制表符（tab） &nbsp; 显示成 &nbsp; ^I，将换页符 &nbsp; <br>&nbsp; （formfeed）显示成 &nbsp; ^ &nbsp; L &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -e &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 在使用-v &nbsp; 选项时，在每一行的行尾显示 &nbsp; $ &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [例子]: &nbsp; &nbsp; <br>&nbsp; cat &nbsp; &nbsp; file &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 显示文件 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cat &nbsp; &nbsp; &nbsp; -s &nbsp; -v &nbsp; -e &nbsp; &nbsp; file1 &nbsp; &nbsp; file2 &nbsp; &nbsp; &nbsp; file3 &nbsp; 逐个显示文件 &nbsp; file1 &nbsp; file2 &nbsp; file3 &nbsp; <br>&nbsp; &nbsp; <br>&nbsp; &nbsp; <br>&nbsp; G. 1.7 &nbsp; head &nbsp; <br>&nbsp; &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [语法]: &nbsp; &nbsp; &nbsp; &nbsp; head &nbsp; &nbsp; &nbsp; &nbsp; [-n] &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [文件 &nbsp; ...] &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [说明]: &nbsp; &nbsp; &nbsp; &nbsp; 将文件的头n &nbsp; 行显示输出,缺省值为 &nbsp; 10 &nbsp; 行，显示多个文件时，在每个文件的前面加上 &nbsp; ==&gt; &nbsp; 文件名 &nbsp; &lt;== &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [例子]： &nbsp; &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; head &nbsp; &nbsp; -9999 &nbsp; &nbsp; &nbsp; file1 &nbsp; &nbsp; &nbsp; file2 显示文件 &nbsp; file1 &nbsp; 和 &nbsp; file2 &nbsp; 的头 &nbsp; 9999 &nbsp; 行 &nbsp; <br>&nbsp; &nbsp; <br>&nbsp; H. 1.8 &nbsp; &nbsp; &nbsp; &nbsp; more &nbsp; <br>&nbsp; &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [语法]: &nbsp; more &nbsp; &nbsp; &nbsp; [-cdflrsuw] &nbsp; &nbsp; [－ &nbsp; 行数] &nbsp; [+ &nbsp; 行数] &nbsp; [+ &nbsp; / &nbsp; 模式 &nbsp; ] &nbsp; [ &nbsp; 文件 &nbsp; ... &nbsp; ] &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [说明]: &nbsp; 将文件显示在终端上，每次一屏，在左下部显示 &nbsp; －－more－－，若是从文件读出而非从管道，则在后面显示百分比，表示已显示的部分，按回车键则上滚一行，按空格键则上滚一屏，未显示完时可以使用more &nbsp; 命令中的子命令。 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -c &nbsp; &nbsp; &nbsp; &nbsp; 显示文件之前先清屏 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -d &nbsp; &nbsp; &nbsp; &nbsp; 当输错命令时显示错误信息而不是响铃(bell) &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -f &nbsp; &nbsp; &nbsp; &nbsp; 不折叠显示长的行 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -l &nbsp; &nbsp; &nbsp; &nbsp; 不将分页控制符(CTRL &nbsp; D)当作页结束 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -r &nbsp; &nbsp; &nbsp; &nbsp; 一般情况下，more &nbsp; 不显示控制符，本选项使more &nbsp; 显示控制符， &nbsp; <br>&nbsp; &nbsp; &nbsp; 例如，将 &nbsp; (CTRL &nbsp; C) &nbsp; 显示成 &nbsp; ^ &nbsp; C &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -s &nbsp; &nbsp; &nbsp; &nbsp; 将多个空行转换成一个空行显示 &nbsp; <br>&nbsp; &nbsp; &nbsp; -u &nbsp; &nbsp; &nbsp; &nbsp; 禁止产生下划线序列 &nbsp; <br>&nbsp; &nbsp; &nbsp; -w &nbsp; &nbsp; &nbsp; &nbsp; 一般情况下 &nbsp; more &nbsp; 显示完后立即推出，本选项在显示完后作提 &nbsp; <br>&nbsp; 示，敲任意键后推出 &nbsp; <br>&nbsp; &nbsp; &nbsp; -n &nbsp; 行数 &nbsp; 指定每屏显示的行数 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; + &nbsp; 行号 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 从指定行号开始显示 &nbsp; <br>&nbsp; &nbsp; &nbsp; +/模式 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 在文件中搜索指定模式，从模式出现行的上两行开始显示 &nbsp; &nbsp; &nbsp; &nbsp; 文件未显示完时，可以使用more &nbsp; 命令中的子命令，命令中除了! &nbsp; 和 &nbsp; / &nbsp; 以外均不回显，也不用敲回车，当命令破坏 &nbsp; more &nbsp; 提示行时，可用退格键恢复提示行。在以下子命令操作中，i &nbsp; 表示数字，缺省值为 &nbsp; 1。 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; i &nbsp; &nbsp; 空格 &nbsp; &nbsp; 上滚一屏多 &nbsp; i &nbsp; 行 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; i &nbsp; &nbsp; 回车 上滚 &nbsp; i &nbsp; 行 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; i &nbsp; &nbsp; CTRL+D &nbsp; i &nbsp; 缺省时上滚 &nbsp; 11 &nbsp; 行，否则上滚 &nbsp; i &nbsp; 行 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; id &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; i &nbsp; 缺省时上滚 &nbsp; 11 &nbsp; 行，否则上滚 &nbsp; i &nbsp; 行 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; iz &nbsp; &nbsp; i &nbsp; 缺省时上滚一屏，否则定义每屏为 &nbsp; i &nbsp; 行 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; is 跳过 &nbsp; i &nbsp; 行后显示一屏 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; if 跳过 &nbsp; i &nbsp; 屏后显示一屏 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; i &nbsp; CTRL+B 跳回 &nbsp; i &nbsp; 屏后显示一屏 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; b 跳回 &nbsp; 一屏后显示一屏 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; q &nbsp; 或 &nbsp; Q 推出 &nbsp; more &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; = 显示当前行号 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; v 从当前行开始编辑当前文件编辑器由环境变量 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $EDITOR定义 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; h 显示帮助信息 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; i &nbsp; / &nbsp; 模式 向前搜索，直至模式的第 &nbsp; i &nbsp; 次出现 &nbsp; ， &nbsp; 从该行的上 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 两行开始显示一屏 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; in 向前搜索，直至上一模式的第 &nbsp; i &nbsp; 次出现 &nbsp; ， &nbsp; 从该行 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 的上两行开始显示一屏 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; 单引号 回到上次搜索的出发点，若无搜索则回到开始位置 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; ! &nbsp; 命令 激活一个sh &nbsp; 去执行指定的命令 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; i &nbsp; ： &nbsp; n 跳到后面第 &nbsp; i &nbsp; 个文件，若不存在则跳到最后一个文件 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; ：f 显示当前文件名和行号 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; ：q &nbsp; 或 &nbsp; ：Q 推出 &nbsp; more &nbsp; &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; . &nbsp; (点) 重复上次命令 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [ &nbsp; 例子]: &nbsp; <br>&nbsp; more &nbsp; &nbsp; &nbsp; -c &nbsp; &nbsp; &nbsp; +50 &nbsp; &nbsp; &nbsp; file &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 清屏后，从第50行开始显示文件 &nbsp; file &nbsp; &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; more &nbsp; &nbsp; -s &nbsp; -w &nbsp; &nbsp; file1 &nbsp; &nbsp; file2 &nbsp; &nbsp; file3 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 显示文件 &nbsp; file1 &nbsp; &nbsp; file2 &nbsp; &nbsp; file3 &nbsp; <br>&nbsp; &nbsp; <br>&nbsp; &nbsp; <br>&nbsp; I. 1.9 &nbsp; &nbsp; &nbsp; cp &nbsp; <br>&nbsp; &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [语法]: &nbsp; &nbsp; cp &nbsp; [ &nbsp; -p &nbsp; ] &nbsp; &nbsp; [ &nbsp; -r &nbsp; ] &nbsp; &nbsp; 文件 &nbsp; 1 &nbsp; [ &nbsp; 文件 &nbsp; 2 &nbsp; ...] &nbsp; &nbsp; 目标 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [说明]: &nbsp; &nbsp; 将文件1(文件2 &nbsp; ...)拷贝到目标上，目标不能与文件同名， &nbsp; 若目标是文件名，则拷贝的文件只能有一个，若目标是目录， &nbsp; 则拷贝的文件可以有多个，若目标文件不存在，则建立这个文件，若存在，则覆盖其以前的内容，若目标是目录，则将文件拷贝到这个目录下。 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; - &nbsp; i &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 在覆盖已存在文件时作提示，若回答 &nbsp; y &nbsp; 则覆盖，其他则中止 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; - &nbsp; p &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 不仅拷贝文件内容，还有修改时间，存取模式，存取控制表， &nbsp; 但不拷贝 &nbsp; &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; UID &nbsp; 及 &nbsp; GID &nbsp; <br>&nbsp; &nbsp; - &nbsp; r &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 若文件名为目录，则拷贝目录下所有文件及子目录和它们的文件，此时 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 目标必须为目录 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [例子]: &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; cp &nbsp; &nbsp; &nbsp; file1 &nbsp; &nbsp; &nbsp; file2 &nbsp; 将文件 &nbsp; file1 &nbsp; 拷贝到文件 &nbsp; file2 &nbsp; <br>&nbsp; &nbsp; &nbsp; cp &nbsp; &nbsp; &nbsp; file1 &nbsp; &nbsp; &nbsp; file2 &nbsp; /tmp &nbsp; 将文件 &nbsp; file1 &nbsp; 和文件 &nbsp; file2 &nbsp; 拷贝到目录 &nbsp; /tmp &nbsp; 下 &nbsp; <br>&nbsp; &nbsp; &nbsp; cp &nbsp; -r &nbsp; /tmp &nbsp; /mytmp &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 将目录 &nbsp; /tmp &nbsp; 下所有文件及其子目录拷贝至目录/mytmp &nbsp; <br>&nbsp; &nbsp; <br>&nbsp; J. 1.10 &nbsp; mv &nbsp; &nbsp; &nbsp; <br>&nbsp; &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [语法]: &nbsp; &nbsp; mv &nbsp; &nbsp; [-f] &nbsp; &nbsp; [-i] &nbsp; 文件1 &nbsp; [文件2...] &nbsp; 目标 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [说明]: &nbsp; &nbsp; 将文件移动至目标，若目标是文件名，则相当于文件改名 &nbsp; <br>&nbsp; &nbsp; - &nbsp; i &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 在覆盖已存在文件时作提示，若回答 &nbsp; y &nbsp; 则覆盖，其他则中止 &nbsp; <br>&nbsp; &nbsp; - &nbsp; f &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 覆盖前不作任何提示 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [例子]: &nbsp; <br>&nbsp; &nbsp; mv &nbsp; &nbsp; file1 &nbsp; &nbsp; &nbsp; file2 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 将文件 &nbsp; file1 &nbsp; 改名为 &nbsp; file2 &nbsp; <br>&nbsp; &nbsp; mv &nbsp; &nbsp; file1 &nbsp; &nbsp; &nbsp; file2 &nbsp; &nbsp; /tmp 将文件 &nbsp; file1 &nbsp; 和文件 &nbsp; file2 &nbsp; &nbsp; 移动到目录 &nbsp; /tmp &nbsp; 下 <br>K. 1.11 &nbsp; rm &nbsp; &nbsp; <br>&nbsp; &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [语法]: &nbsp; &nbsp; &nbsp; &nbsp; rm &nbsp; &nbsp; [-f] &nbsp; &nbsp; [-i] &nbsp; &nbsp; 文件... &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 或 &nbsp; rm &nbsp; &nbsp; -r &nbsp; &nbsp; [-f] &nbsp; &nbsp; [-i] &nbsp; &nbsp; 目录名... &nbsp; [文件] &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [说明]: &nbsp; &nbsp; &nbsp; 用来删除文件或目录 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; - &nbsp; f &nbsp; &nbsp; &nbsp; &nbsp; 删除文件时不作提示 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; - &nbsp; r &nbsp; &nbsp; &nbsp; &nbsp; 递归地删除目录及其所有子目录 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; - &nbsp; i &nbsp; &nbsp; &nbsp; &nbsp; 删除文件之前先作提示 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [例子]: &nbsp; &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rm &nbsp; &nbsp; file1 &nbsp; 删除文件 &nbsp; file1 &nbsp; <br>&nbsp; &nbsp; &nbsp; rm &nbsp; &nbsp; -i &nbsp; &nbsp; &nbsp; /tmp/* 删除目录 &nbsp; /tmp &nbsp; &nbsp; 下的所有文件 &nbsp; <br>&nbsp; &nbsp; &nbsp; rm &nbsp; &nbsp; -r &nbsp; &nbsp; /mytmp 递归地删除目录 &nbsp; /mytmp &nbsp; <br>&nbsp; &nbsp; <br>&nbsp; &nbsp; <br>&nbsp; L. 1.12 &nbsp; &nbsp; &nbsp; chmod &nbsp; <br>&nbsp; &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; [语法]: &nbsp; &nbsp; &nbsp; &nbsp; chmod &nbsp; &nbsp; [-R] &nbsp; &nbsp; 模式 &nbsp; &nbsp; &nbsp; 文件... &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 或 &nbsp; chmod &nbsp; &nbsp; [ugoa] &nbsp; &nbsp; {+|-|=} &nbsp; &nbsp; [rwxst] &nbsp; &nbsp; 文件... &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; [说明]: &nbsp; 改变文件的存取模式，存取模式可表示为数字或符号串，例如： &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; chmod &nbsp; &nbsp; &nbsp; &nbsp; nnnn &nbsp; &nbsp; &nbsp; file &nbsp; ， &nbsp; &nbsp; n为0-7的数字，意义如下: &nbsp; <br>&nbsp; 4000 运行时可改变UID &nbsp; <br>&nbsp; 2000 运行时可改变GID &nbsp; <br>&nbsp; 1000 置粘着位 &nbsp; <br>&nbsp; 0400 文件主可读 &nbsp; <br>&nbsp; 0200 文件主可写 &nbsp; <br>&nbsp; 0100 文件主可执行 &nbsp; <br>&nbsp; 0040 同组用户可读 &nbsp; <br>&nbsp; 0020 同组用户可写 &nbsp; <br>&nbsp; 0010 同组用户可执行 &nbsp; <br>&nbsp; 0004 其他用户可读 &nbsp; <br>&nbsp; 0002 其他用户可写 &nbsp; <br>&nbsp; 0001 其他用户可执行 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; nnnn &nbsp; 就是上列数字相加得到的，例如 &nbsp; chmod &nbsp; 0777 &nbsp; &nbsp; &nbsp; file &nbsp; &nbsp; 是指将文件 &nbsp; file &nbsp; 存取权限置为所有用户可读可写可执行。 &nbsp; <br>&nbsp; &nbsp; -R 递归地改变所有子目录下所有文件的存取模式 &nbsp; <br>&nbsp; &nbsp; u 文件主 &nbsp; <br>&nbsp; &nbsp; g &nbsp; 同组用户 &nbsp; <br>&nbsp; &nbsp; o 其他用户 &nbsp; <br>&nbsp; &nbsp; a 所有用户 &nbsp; <br>&nbsp; &nbsp; + 增加后列权限 &nbsp; <br>&nbsp; &nbsp; - 取消后列权限 &nbsp; <br>&nbsp; &nbsp; = 置成后列权限 &nbsp; <br>&nbsp; &nbsp; r 可读 &nbsp; <br>&nbsp; &nbsp; w 可写 &nbsp; <br>&nbsp; &nbsp; x 可执行 &nbsp; <br>&nbsp; &nbsp; s 运行时可置UID &nbsp; <br>&nbsp; &nbsp; t 运行时可置GID &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [例子]: &nbsp; <br>&nbsp; &nbsp; chmod &nbsp; &nbsp; &nbsp; 0666 &nbsp; &nbsp; file1 &nbsp; &nbsp; file2 &nbsp; &nbsp; 将文件 &nbsp; file1 &nbsp; 及 &nbsp; file2 &nbsp; 置为所有用户可读可写 &nbsp; <br>&nbsp; &nbsp; chmod &nbsp; &nbsp; &nbsp; u+x &nbsp; &nbsp; &nbsp; file &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 对文件 &nbsp; file &nbsp; 增加文件主可执行权限 &nbsp; <br>&nbsp; &nbsp; chmod &nbsp; &nbsp; &nbsp; o-rwx &nbsp; &nbsp; &nbsp; &nbsp; 对文件file &nbsp; 取消其他用户的所有权限 &nbsp; <br>&nbsp; &nbsp; <br>&nbsp; &nbsp; <br>&nbsp; M. 1.13 &nbsp; chown &nbsp; &nbsp; <br>&nbsp; &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [语法]: &nbsp; &nbsp; chown &nbsp; &nbsp; [-R] &nbsp; &nbsp; 文件主 &nbsp; &nbsp; &nbsp; 文件... &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [说明]: &nbsp; &nbsp; 文件的UID表示文件的文件主，文件主可用数字表示， &nbsp; 也可用一个有效的用户名表示，此命令改变一个文件的UID，仅当此文件的文件主或超级用户可使用。 &nbsp; <br>&nbsp; &nbsp; -R 递归地改变所有子目录下所有文件的存取模式 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [例子]: &nbsp; <br>&nbsp; &nbsp; &nbsp; chown &nbsp; &nbsp; &nbsp; mary &nbsp; &nbsp; file 将文件 &nbsp; file &nbsp; &nbsp; 的文件主改为 &nbsp; mary &nbsp; <br>&nbsp; &nbsp; &nbsp; chown &nbsp; &nbsp; &nbsp; 150 &nbsp; &nbsp; &nbsp; file &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 将文件 &nbsp; file &nbsp; 的UID改为150 &nbsp; <br>&nbsp; &nbsp; <br>&nbsp; &nbsp; <br>&nbsp; N. 1.14 &nbsp; chgrp &nbsp; &nbsp; <br>&nbsp; &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [语法]: &nbsp; &nbsp; chgrp &nbsp; [-R] &nbsp; &nbsp; 文件组 &nbsp; &nbsp; 文件... &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [说明]： &nbsp; &nbsp; 文件的GID表示文件的文件组，文件组可用数字表示， &nbsp; 也可用一个有效的组名表示，此命令改变一个文件的GID，可参看chown。 &nbsp; <br>&nbsp; &nbsp; -R 递归地改变所有子目录下所有文件的存取模式 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [例子]: &nbsp; <br>&nbsp; &nbsp; chgrp &nbsp; &nbsp; group &nbsp; &nbsp; &nbsp; file 将文件 &nbsp; file &nbsp; &nbsp; 的文件组改为 &nbsp; group &nbsp; <br>&nbsp; &nbsp; <br>&nbsp; &nbsp; <br>&nbsp; 1.15 &nbsp; &nbsp; &nbsp; cmp &nbsp; <br>&nbsp; &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [语法]: &nbsp; &nbsp; cmp &nbsp; &nbsp; [-l] &nbsp; &nbsp; [-s] &nbsp; &nbsp; 文件1 &nbsp; &nbsp; 文件2 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [说明]: &nbsp; &nbsp; 比较两个文件，若文件1 &nbsp; 为 &nbsp; "-" &nbsp; ，则使用标准输入， &nbsp; 两个文件相同则无提示，不同则显示出现第一个不同时的字符数和行号。 &nbsp; <br>&nbsp; &nbsp; -l 显示每个不同处的字节数(10进制)和不同的字节(8进制) &nbsp; <br>&nbsp; &nbsp; -s 不作任何提示，只返回码 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [例子]: &nbsp; <br>&nbsp; &nbsp; cmp &nbsp; &nbsp; file1 &nbsp; &nbsp; &nbsp; file2 比较文件 &nbsp; file1 &nbsp; 和 &nbsp; file2 &nbsp; <br>&nbsp; &nbsp; cmp &nbsp; -l &nbsp; file1 &nbsp; file2 比较文件file1 &nbsp; 和 &nbsp; file2 &nbsp; 的每处不同 &nbsp; <br>&nbsp; &nbsp; <br>&nbsp; O. 1.16 &nbsp; diff &nbsp; <br>&nbsp; &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [语法]: &nbsp; diff &nbsp; &nbsp; [-be] &nbsp; &nbsp; 文件1 &nbsp; &nbsp; &nbsp; 文件2 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [说明]: &nbsp; 本命令比较两个文本文件，将不同的行列出来 &nbsp; <br>&nbsp; &nbsp; -b 将一串空格或TAB转换成一个空格或TAB &nbsp; <br>&nbsp; &nbsp; -e 生成一个编辑角本，作为ex或ed的输入可将文件1转换成文件2 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [例子]: &nbsp; <br>&nbsp; diff &nbsp; &nbsp; &nbsp; &nbsp; file1 &nbsp; file2 &nbsp; <br>&nbsp; diff &nbsp; -b &nbsp; file1 &nbsp; file2 &nbsp; <br>&nbsp; diff &nbsp; -e &nbsp; file1 &nbsp; file2 &nbsp; &gt;edscript &nbsp; <br>&nbsp; &nbsp; <br>&nbsp; &nbsp; <br>&nbsp; P. 1.17 &nbsp; wc &nbsp; <br>&nbsp; &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [语法]: &nbsp; wc &nbsp; &nbsp; [-lwc] &nbsp; &nbsp; &nbsp; &nbsp; 文件... &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [说明]: &nbsp; 统计文件的行、字、字符数，若无指定文件，则统计标准输入 &nbsp; <br>&nbsp; &nbsp; -l &nbsp; 只统计行数 &nbsp; <br>&nbsp; &nbsp; -w 只统计字数 &nbsp; <br>&nbsp; &nbsp; -c 只统计字符数 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [例子]: &nbsp; <br>&nbsp; &nbsp; wc &nbsp; &nbsp; -l &nbsp; &nbsp; file1 &nbsp; &nbsp; file2 统计文件file1和file2 &nbsp; 的行数 &nbsp; <br>&nbsp; &nbsp; <br>&nbsp; &nbsp; <br>&nbsp; Q. 1.18 &nbsp; split &nbsp; <br>&nbsp; &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [语法]: &nbsp; &nbsp; split &nbsp; &nbsp; [-n] &nbsp; &nbsp; &nbsp; [ &nbsp; 文件 &nbsp; &nbsp; [名字]] &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [说明]: &nbsp; &nbsp; split &nbsp; 将指定大文件分解为若干个小文件，每个文件长度为n行(n &nbsp; 缺省时为1000)，第一个小文件名为指定的名字后跟aa，直至zz，名字缺省值为x，若未指定大文件名，则使用标准输入 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [例子]: &nbsp; &nbsp; &nbsp; <br>&nbsp; &nbsp; split &nbsp; &nbsp; -500 &nbsp; &nbsp; &nbsp; largefile &nbsp; &nbsp; &nbsp; little &nbsp; <br>&nbsp; &nbsp; 将文件largefile &nbsp; 每500行写入一个文件，第一个文件名为littleaa &nbsp; <br>&nbsp; &nbsp; <br>&nbsp; &nbsp; <br>&nbsp; R. 1.19 &nbsp; touch &nbsp; &nbsp; <br>&nbsp; &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [语法]: &nbsp; touch &nbsp; &nbsp; [-amc] &nbsp; &nbsp; [mmddhhmm[yy]] &nbsp; &nbsp; 文件... &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [说明]: &nbsp; &nbsp; 将指定文件的访问时间和修改时间改变，若指定文件不存在则创建之，若无指定时间，则使用当前时间，返回值是未成功改变时间的文件个数，包括不存在而又未能创建的文件。 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -a &nbsp; 只改变访问时间 &nbsp; <br>&nbsp; &nbsp; -m &nbsp; 只改变修改时间 &nbsp; <br>&nbsp; &nbsp; -c 若文件不存在，不创建它且不作提示 &nbsp; <br>&nbsp; &nbsp; mmddhhmm[yy] &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 两位表示 &nbsp; 月日时分[年] &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [例子]: &nbsp; <br>&nbsp; &nbsp; touch &nbsp; &nbsp; file &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br>&nbsp; &nbsp; 更新文件file的时间 &nbsp; <br>&nbsp; &nbsp; touch &nbsp; &nbsp; 0701000097 &nbsp; &nbsp; HongKong &nbsp; <br>&nbsp; &nbsp; 将文件HongKong的时间改为97年7月1日0时0分 &nbsp; <br>&nbsp; &nbsp; <br>&nbsp; &nbsp; <br>&nbsp; &nbsp; <br>&nbsp; &nbsp; <br>&nbsp; S. 1.20 &nbsp; file &nbsp; &nbsp; <br>&nbsp; &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [语法]: &nbsp; &nbsp; file &nbsp; &nbsp; [-f &nbsp; &nbsp; 文件名文件] &nbsp; 文件... &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [说明]: &nbsp; &nbsp; file &nbsp; 对指定文件进行测试，尽量猜测出文件类型并显示出来 &nbsp; <br>&nbsp; &nbsp; -f &nbsp; &nbsp; 文件名文件 文件名文件是一个包含了文件名的文本文件， &nbsp; -f &nbsp; 选项测试 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 文件名文件中所列出的文件 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [例子]: &nbsp; <br>&nbsp; &nbsp; &nbsp; file &nbsp; &nbsp; * 显示当前目录下所有文件的类型<br>T. 1.21 &nbsp; pack &nbsp; &nbsp; &nbsp; &nbsp; <br>&nbsp; &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [语法]: &nbsp; &nbsp; pack &nbsp; &nbsp; 文件... &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [说明]: &nbsp; &nbsp; pack &nbsp; 将指定文件转储为压缩格式，文件名后加 &nbsp; ".z &nbsp; "， &nbsp; 文件存取模式，访问时间，修改时间等均不变 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [例子]: &nbsp; <br>&nbsp; &nbsp; &nbsp; pack &nbsp; &nbsp; largefile 将largefile &nbsp; 压缩后转储为largefile.z &nbsp; <br>&nbsp; &nbsp; <br>&nbsp; &nbsp; <br>&nbsp; U. 1.22 &nbsp; pcat &nbsp; &nbsp; 显示压缩文件 &nbsp; <br>&nbsp; &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [语法]: &nbsp; &nbsp; pcat &nbsp; &nbsp; &nbsp; 文件... &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [说明]: &nbsp; &nbsp; pcat &nbsp; &nbsp; 显示输出压缩文件 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; <br>&nbsp; &nbsp; [例子]: &nbsp; &nbsp; &nbsp; <br>&nbsp; pcat &nbsp; &nbsp; largefile.z 显示压缩前的largefile &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pcat &nbsp; &nbsp; largefile.z &nbsp; &gt; &nbsp; oldfile 显示压缩前的laregfile，并将其重定向到 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 文件oldfile中 &nbsp; <br>&nbsp; &nbsp; <br>&nbsp; &nbsp; <br>&nbsp; V. 1.23 &nbsp; &nbsp; &nbsp; unpack &nbsp; <br>&nbsp; &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [语法]: &nbsp; unpack &nbsp; &nbsp; 文件... &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [说明]: &nbsp; 将压缩后的文件解压后转储为压缩前的格式 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [例子]: &nbsp; &nbsp; <br>&nbsp; &nbsp; &nbsp; unpack &nbsp; &nbsp; largefile.z 将压缩文件largefile.z解压后转储为largefile &nbsp; <br>&nbsp; &nbsp; <br>&nbsp; &nbsp; <br>&nbsp; W. 1.24 &nbsp; find &nbsp; <br>&nbsp; &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; [语法]: &nbsp; find &nbsp; &nbsp; &nbsp; &nbsp; 路径名... &nbsp; &nbsp; &nbsp; &nbsp; 表达式 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; [说明]: &nbsp; find &nbsp; 命令递归地遍历指定路径下的每个文件和子目录，看该文件是否能使表达式值为真，以下 &nbsp; n &nbsp; 代表一个十进制整数，+n &nbsp; 代表打印 &nbsp; n &nbsp; ， &nbsp; -n &nbsp; 代表小于 &nbsp; n &nbsp; ，下面是合法表达式说明： &nbsp; <br>&nbsp; -name &nbsp; &nbsp; 模式 &nbsp; &nbsp; &nbsp; 文件名与模式匹配则为真，(\ &nbsp; 为转意符) &nbsp; <br>&nbsp; &nbsp; &nbsp; -perm &nbsp; &nbsp; [-]八进制数 文件存取模式与八进制数相同则为真若有- &nbsp; 选项，则文件存 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 取模式含有八进制数规定模式即为真 &nbsp; <br>&nbsp; &nbsp; -size &nbsp; &nbsp; n[c] 文件块长度为 &nbsp; n &nbsp; 则真(一块为512字节)，若 &nbsp; <br>&nbsp; 有c &nbsp; 选项，则文件字节长度为 &nbsp; n &nbsp; 则真 &nbsp; <br>&nbsp; -atime &nbsp; n 若文件的最近访问时间为 &nbsp; n &nbsp; 天前则为真， &nbsp; <br>&nbsp; find &nbsp; 命令将改变其访问的目录的访问时间 &nbsp; <br>&nbsp; -mtime &nbsp; n 若文件的最近修改时间为 &nbsp; n &nbsp; 天前则为真 &nbsp; <br>&nbsp; -ctime &nbsp; n 若文件状态为 &nbsp; n &nbsp; 天前改变则为真 &nbsp; <br>&nbsp; -exec &nbsp; 命令 &nbsp; &nbsp; { &nbsp; }\; 若命令返回值为0则真，{ &nbsp; }内为命令参数, &nbsp; <br>&nbsp; 此命令必须以 &nbsp; \; &nbsp; 为结束 &nbsp; <br>&nbsp; -ok &nbsp; 命令 &nbsp; &nbsp; &nbsp; &nbsp; { &nbsp; }\; 与 &nbsp; exec &nbsp; 相同，只是在命令执行前先提示，若 &nbsp; <br>&nbsp; 回答 &nbsp; y &nbsp; 则执行命令 &nbsp; <br>&nbsp; -print 显示输出使表达式为真的文件名 &nbsp; <br>&nbsp; -newer &nbsp; 文件 若文件的访问时间比newer &nbsp; 指定的文件新则真 &nbsp; <br>&nbsp; -depth 先下降到搜索目录的子目录，然后才至其自身 &nbsp; <br>&nbsp; -mount 仅查找包含指定目录的文件系统 &nbsp; <br>&nbsp; -local 文件在当前文件系统时为真 &nbsp; <br>&nbsp; -type &nbsp; &nbsp; c 文件类型为 &nbsp; c &nbsp; 则真，c &nbsp; 取值可为 &nbsp; b(块文件) &nbsp; c &nbsp; (字符文件) &nbsp; &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; d(目录) &nbsp; l &nbsp; (符号链接) &nbsp; p &nbsp; (命名管道) &nbsp; f &nbsp; (普通文件) &nbsp; <br>&nbsp; \( &nbsp; &nbsp; 表达式 &nbsp; \) &nbsp; &nbsp; &nbsp; 表达式为真则真 &nbsp; <br>&nbsp; -links &nbsp; &nbsp; n 文件链接数为 &nbsp; n &nbsp; 时为真 &nbsp; <br>&nbsp; -user &nbsp; &nbsp; &nbsp; 用户 当文件属于用户时为真，用户可用数字表示UID &nbsp; <br>&nbsp; -nouser &nbsp; &nbsp; 当文件不属于 &nbsp; /etc/passwd &nbsp; 中的一个用户时为真 &nbsp; <br>&nbsp; -group &nbsp; &nbsp; 文件组 当文件属于文件组时为真，文件组可用数字表示GID &nbsp; <br>&nbsp; -nogroup 当文件不属于 &nbsp; /etc/group &nbsp; 中的一个组时为真 &nbsp; <br>&nbsp; -fstype &nbsp; &nbsp; &nbsp; 类型 当文件所属文件系统类型为指定类型时真 &nbsp; <br>&nbsp; -inum &nbsp; &nbsp; &nbsp; &nbsp; n 当文件 &nbsp; i &nbsp; 节点号为 &nbsp; n &nbsp; 时为真 &nbsp; <br>&nbsp; -prune &nbsp; &nbsp; &nbsp; 当目录名与模式匹配时，不再搜索其子目录 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 可以用逻辑操作符将简单表达式连接成复杂表达式 &nbsp; <br>&nbsp; 逻辑操作符有 &nbsp; ! &nbsp; 表示非操作， &nbsp; -o &nbsp; &nbsp; 表示或操作，两个表达式并列则表示 &nbsp; <br>&nbsp; 与操作 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; [例子]: &nbsp; <br>&nbsp; find &nbsp; / &nbsp; -name &nbsp; find* &nbsp; -print &nbsp; <br>&nbsp; 从根目录开始搜索文件名如 &nbsp; find* &nbsp; 的文件并显示之 &nbsp; <br>&nbsp; find &nbsp; ./ &nbsp; -exec &nbsp; sleep{1}\; &nbsp; -print &nbsp; <br>&nbsp; &nbsp; &nbsp; 每秒显示一个当前目录下的文件 &nbsp; <br>&nbsp; find &nbsp; $HOME &nbsp; \(-name &nbsp; a.out &nbsp; -o &nbsp; -name &nbsp; '*.o' &nbsp; \) &nbsp; -atime &nbsp; +7 &nbsp; &nbsp; -exec &nbsp; &nbsp; &nbsp; rm &nbsp; {} &nbsp; \; &nbsp; <br>&nbsp; 从$HOME目录开始搜索，删除所有文件名为a.out &nbsp; 或 &nbsp; *.o &nbsp; 且访问时间在7天前的文件 &nbsp; <br>&nbsp; &nbsp; <br>&nbsp; &nbsp; <br>&nbsp; X. 1.25 &nbsp; grep &nbsp; <br>&nbsp; &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; [语法]: &nbsp; &nbsp; grep &nbsp; &nbsp; [选项] &nbsp; 模式 &nbsp; &nbsp; [文件...] &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; [说明]: &nbsp; &nbsp; 在指定的文件中搜索模式，并显示所有包含模式的行，模式是一个正规表达式，在使用正规表达式时，最好将其引在单引号(') &nbsp; 中，若指定文件为缺省，则使用标准输入，正规表达式可以是： &nbsp; <br>&nbsp; . &nbsp; &nbsp; 匹配任意一个字符 &nbsp; <br>&nbsp; * 匹配0个或多个*前的字符 &nbsp; <br>&nbsp; ^ 匹配行开头 &nbsp; <br>&nbsp; $ 匹配行结尾 &nbsp; <br>&nbsp; [] 匹配[ &nbsp; ]中的任意一个字符，[]中可用 &nbsp; - &nbsp; 表示范围， &nbsp; <br>&nbsp; 例如[a-z]表示字母a &nbsp; 至z &nbsp; 中的任意一个 &nbsp; <br>&nbsp; \ 转意字符 &nbsp; <br>&nbsp; 命令中的选项为： &nbsp; <br>&nbsp; -b 显示块号 &nbsp; <br>&nbsp; -c 仅显示各指定文件中包含模式的总行数 &nbsp; <br>&nbsp; -i 模式中字母不区分大小写 &nbsp; <br>&nbsp; -h 不将包含模式的文件名显示在该行上 &nbsp; <br>&nbsp; -l 仅显示包含模式的文件名 &nbsp; <br>&nbsp; -n 显示模式所在行的行号 &nbsp; <br>&nbsp; -s 指定文件若不存在或不可读，不提示错误信息 &nbsp; <br>&nbsp; -v 显示所有不包含模式的行 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; [例子]: &nbsp; <br>&nbsp; grep &nbsp; &nbsp; &nbsp; 'good' &nbsp; &nbsp; * 在所有文件中搜索含有字符串 &nbsp; good &nbsp; &nbsp; 的行 &nbsp; <br>&nbsp; grep &nbsp; &nbsp; &nbsp; '^myline' &nbsp; &nbsp; mytext 在文件mytext中搜索行首出现myline字符串的行&nbsp;&nbsp;<img src ="http://www.blogjava.net/etlan/aggbug/124247.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/etlan/" target="_blank">张秀兰</a> 2007-06-14 10:12 <a href="http://www.blogjava.net/etlan/archive/2007/06/14/124247.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>总结下:ajax,jsp,java的web应用程序:随时问</title><link>http://www.blogjava.net/etlan/archive/2007/06/07/122604.html</link><dc:creator>张秀兰</dc:creator><author>张秀兰</author><pubDate>Thu, 07 Jun 2007 07:34:00 GMT</pubDate><guid>http://www.blogjava.net/etlan/archive/2007/06/07/122604.html</guid><wfw:comment>http://www.blogjava.net/etlan/comments/122604.html</wfw:comment><comments>http://www.blogjava.net/etlan/archive/2007/06/07/122604.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/etlan/comments/commentRss/122604.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/etlan/services/trackbacks/122604.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 一个叫随时问的流程,写个总结.相当长,相信你有耐心看完!哈哈嘻嘻!先画个流程图吧:web端ajax,java,jsp流程图先来写个.js,叫webask.js/**&nbsp;* Send the data to server &nbsp;*/function XmlHttpSend(url, method, params, asyn){&nbsp;var headers = ne...&nbsp;&nbsp;<a href='http://www.blogjava.net/etlan/archive/2007/06/07/122604.html'>阅读全文</a><img src ="http://www.blogjava.net/etlan/aggbug/122604.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/etlan/" target="_blank">张秀兰</a> 2007-06-07 15:34 <a href="http://www.blogjava.net/etlan/archive/2007/06/07/122604.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Cannot create an user thread. On NT check username, and IXUSERS group.</title><link>http://www.blogjava.net/etlan/archive/2007/05/31/121159.html</link><dc:creator>张秀兰</dc:creator><author>张秀兰</author><pubDate>Thu, 31 May 2007 06:30:00 GMT</pubDate><guid>http://www.blogjava.net/etlan/archive/2007/05/31/121159.html</guid><wfw:comment>http://www.blogjava.net/etlan/comments/121159.html</wfw:comment><comments>http://www.blogjava.net/etlan/archive/2007/05/31/121159.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/etlan/comments/commentRss/121159.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/etlan/services/trackbacks/121159.html</trackback:ping><description><![CDATA[最近测试环境的imformix数据库换了个demo,经常出现:<br>java.sql.SQLException: Cannot create an user thread. On NT check username, and IXUSERS group.<br>只要有二个连接:dbaccess就会抛出:<br>java.sql.SQLException: Cannot create an user thread. On NT check username, and IXUSERS group.<br>共用测试环境技术总监配,真不知道他为啥要用这个demo!<br>当出现抛出异常时只好重启tomcat,再不行,把有相关的线程kill再重启了<br>(有点无耐)<br><br>顺便记下:<br>informix表被锁定时,解决方法<br>(在informix用户下)<br>onstat&nbsp; -g&nbsp; ses(查看哪些占了表进程)<br>onmode -z&nbsp; session id (杀session id) <br>若还不能解决问题,那你得看下日志文件是否满了.(曾经就有碰过,还浪费了很长时间去检查<br>程序....)<img src ="http://www.blogjava.net/etlan/aggbug/121159.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/etlan/" target="_blank">张秀兰</a> 2007-05-31 14:30 <a href="http://www.blogjava.net/etlan/archive/2007/05/31/121159.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>各种数据库如何读取前N条记录</title><link>http://www.blogjava.net/etlan/archive/2007/05/18/118236.html</link><dc:creator>张秀兰</dc:creator><author>张秀兰</author><pubDate>Fri, 18 May 2007 01:26:00 GMT</pubDate><guid>http://www.blogjava.net/etlan/archive/2007/05/18/118236.html</guid><wfw:comment>http://www.blogjava.net/etlan/comments/118236.html</wfw:comment><comments>http://www.blogjava.net/etlan/archive/2007/05/18/118236.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/etlan/comments/commentRss/118236.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/etlan/services/trackbacks/118236.html</trackback:ping><description><![CDATA[1.&nbsp;ORACLE&nbsp;<br>Select&nbsp;*&nbsp;FROM&nbsp;TABLE1&nbsp;Where&nbsp;ROWNUM&lt;=N&nbsp;<br><br>2.&nbsp;INFORMIX&nbsp;<br>Select&nbsp;FIRST&nbsp;N&nbsp;*&nbsp;FROM&nbsp;TABLE1&nbsp;where&nbsp;1=1&nbsp;<br><br>3.&nbsp;MYSQL&nbsp;<br>Select&nbsp;*&nbsp;FROM&nbsp;TABLE1&nbsp;where&nbsp;1=1&nbsp;LIMIT&nbsp;N&nbsp;<br>(以上三种是俺工作中用到的数据库)<br><br>4.&nbsp;DB2&nbsp;<br>Select&nbsp;*&nbsp;ROW_NUMBER()&nbsp;OVER(ORDER&nbsp;BY&nbsp;COL1&nbsp;DESC)&nbsp;AS&nbsp;ROWNUM&nbsp;Where&nbsp;ROWNUM&lt;=N&nbsp;<br>或者<br>Select&nbsp;COLUMN&nbsp;FROM&nbsp;TABLE&nbsp;where&nbsp;1=1&nbsp;FETCH&nbsp;FIRST&nbsp;N&nbsp;ROWS&nbsp;ONLY&nbsp;<br><br>5.&nbsp;SQL&nbsp;SERVER&nbsp;<br>Select&nbsp;TOP&nbsp;N&nbsp;*&nbsp;FROM&nbsp;TABLE1&nbsp;where&nbsp;1=1&nbsp;<br>or<br>SET&nbsp;ROWCOUNT&nbsp;N&nbsp;Select&nbsp;*&nbsp;FROM&nbsp;TABLE1&nbsp;where&nbsp;1=1&nbsp;SET&nbsp;ROWCOUNT&nbsp;N1<br><br>6.&nbsp;SYBASE&nbsp;<br>SET&nbsp;ROWCOUNT&nbsp;N&nbsp;Select&nbsp;*&nbsp;FROM&nbsp;TABLE1&nbsp;where&nbsp;1=1&nbsp;SET&nbsp;ROWCOUNT&nbsp;N1<br><br><br>7.&nbsp;FOXPRO&nbsp;<br>Select&nbsp;*&nbsp;TOP&nbsp;N&nbsp;FROM&nbsp;TABLE&nbsp;orDER&nbsp;BY&nbsp;COLUMN<br><br>8.&nbsp;ACCESS&nbsp;<br>Select&nbsp;TOP&nbsp;N&nbsp;*&nbsp;FROM&nbsp;TABLE1&nbsp;where&nbsp;1=1<br><img src ="http://www.blogjava.net/etlan/aggbug/118236.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/etlan/" target="_blank">张秀兰</a> 2007-05-18 09:26 <a href="http://www.blogjava.net/etlan/archive/2007/05/18/118236.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>ASCII码值表</title><link>http://www.blogjava.net/etlan/archive/2007/04/16/111008.html</link><dc:creator>张秀兰</dc:creator><author>张秀兰</author><pubDate>Mon, 16 Apr 2007 08:31:00 GMT</pubDate><guid>http://www.blogjava.net/etlan/archive/2007/04/16/111008.html</guid><wfw:comment>http://www.blogjava.net/etlan/comments/111008.html</wfw:comment><comments>http://www.blogjava.net/etlan/archive/2007/04/16/111008.html#Feedback</comments><slash:comments>4</slash:comments><wfw:commentRss>http://www.blogjava.net/etlan/comments/commentRss/111008.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/etlan/services/trackbacks/111008.html</trackback:ping><description><![CDATA[<pre>Char  Dec  Oct  Hex | Char  Dec  Oct  Hex | Char  Dec  Oct  Hex | Char Dec Oct Hex
-----------------------------------------------------------------------------------
(nul)   0 0000 0x00 | (sp)   32 0040 0x20 | @     64 0100 0x40 | `    96 0140 0x60
(soh)   1 0001 0x01 | !      33 0041 0x21 | A     65 0101 0x41 | a    97 0141 0x61
(stx)   2 0002 0x02 | "      34 0042 0x22 | B     66 0102 0x42 | b    98 0142 0x62
(etx)   3 0003 0x03 | #      35 0043 0x23 | C     67 0103 0x43 | c    99 0143 0x63
(eot)   4 0004 0x04 | $      36 0044 0x24 | D     68 0104 0x44 | d    100 0144 0x64
(enq)   5 0005 0x05 | %      37 0045 0x25 | E     69 0105 0x45 | e    101 0145 0x65
(ack)   6 0006 0x06 | &amp;      38 0046 0x26 | F     70 0106 0x46 | f    102 0146 0x66
(bel)   7 0007 0x07 | '      39 0047 0x27 | G     71 0107 0x47 | g    103 0147 0x67
(bs)    8 0010 0x08 | (      40 0050 0x28 | H     72 0110 0x48 | h    104 0150 0x68
(ht)    9 0011 0x09 | )      41 0051 0x29 | I     73 0111 0x49 | i    105 0151 0x69
(nl)   10 0012 0x0a | *      42 0052 0x2a | J     74 0112 0x4a | j    106 0152 0x6a
(vt)   11 0013 0x0b | +      43 0053 0x2b | K     75 0113 0x4b | k    107 0153 0x6b
(np)   12 0014 0x0c | ,      44 0054 0x2c | L     76 0114 0x4c | l    108 0154 0x6c
(cr)   13 0015 0x0d | -      45 0055 0x2d | M     77 0115 0x4d | m    109 0155 0x6d
(so)   14 0016 0x0e | .      46 0056 0x2e | N     78 0116 0x4e | n    110 0156 0x6e
(si)   15 0017 0x0f | /      47 0057 0x2f | O     79 0117 0x4f | o    111 0157 0x6f
(dle)  16 0020 0x10 | 0      48 0060 0x30 | P     80 0120 0x50 | p    112 0160 0x70
(dc1)  17 0021 0x11 | 1      49 0061 0x31 | Q     81 0121 0x51 | q    113 0161 0x71
(dc2)  18 0022 0x12 | 2      50 0062 0x32 | R     82 0122 0x52 | r    114 0162 0x72
(dc3)  19 0023 0x13 | 3      51 0063 0x33 | S     83 0123 0x53 | s    115 0163 0x73
(dc4)  20 0024 0x14 | 4      52 0064 0x34 | T     84 0124 0x54 | t    116 0164 0x74
(nak)  21 0025 0x15 | 5      53 0065 0x35 | U     85 0125 0x55 | u    117 0165 0x75
(syn)  22 0026 0x16 | 6      54 0066 0x36 | V     86 0126 0x56 | v    118 0166 0x76
(etb)  23 0027 0x17 | 7      55 0067 0x37 | W     87 0127 0x57 | w    119 0167 0x77
(can)  24 0030 0x18 | 8      56 0070 0x38 | X     88 0130 0x58 | x    120 0170 0x78
(em)   25 0031 0x19 | 9      57 0071 0x39 | Y     89 0131 0x59 | y    121 0171 0x79
(sub)  26 0032 0x1a | :      58 0072 0x3a | Z     90 0132 0x5a | z    122 0172 0x7a
(esc)  27 0033 0x1b | ;      59 0073 0x3b | [     91 0133 0x5b | {    123 0173 0x7b
(fs)   28 0034 0x1c | &lt;      60 0074 0x3c | \     92 0134 0x5c | |    124 0174 0x7c
(gs)   29 0035 0x1d | =      61 0075 0x3d | ]     93 0135 0x5d | }    125 0175 0x7d
(rs)   30 0036 0x1e | &gt;      62 0076 0x3e | ^     94 0136 0x5e | ~    126 0176 0x7e
(us)   31 0037 0x1f | ?      63 0077 0x3f | _     95 0137 0x5f | (del) 127 0177 0x7f</pre>
<pre>
<table>
    <tbody>
        <tr>
            <th>ASCII Name </th><th align=left>Description </th><th>C Escape Sequence </th>
        </tr>
        <tr>
            <td>nul </td>
            <td>null byte </td>
            <td align=middle>\0 </td>
        </tr>
        <tr>
            <td>bel </td>
            <td>bell character </td>
            <td align=middle>\a </td>
        </tr>
        <tr>
            <td>bs </td>
            <td>backspace </td>
            <td align=middle>\b </td>
        </tr>
        <tr>
            <td>ht </td>
            <td>horizontal tab </td>
            <td align=middle>\t </td>
        </tr>
        <tr>
            <td>np </td>
            <td>formfeed </td>
            <td align=middle>\f </td>
        </tr>
        <tr>
            <td>nl </td>
            <td>newline </td>
            <td align=middle>\n </td>
        </tr>
        <tr>
            <td>cr </td>
            <td>carriage return </td>
            <td align=middle>\r </td>
        </tr>
        <tr>
            <td>vt </td>
            <td>vertical tab </td>
            <td></td>
        </tr>
        <tr>
            <td>esc </td>
            <td>escape </td>
            <td></td>
        </tr>
        <tr>
            <td>sp </td>
            <td>space</td>
        </tr>
    </tbody>
</table>
</pre>
<pre>用java程序写<br>char c = '\r';<br>int iAscii = c;//强制类型转换<br>System.out.println("iAscii:"+iAscii);</pre><img src ="http://www.blogjava.net/etlan/aggbug/111008.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/etlan/" target="_blank">张秀兰</a> 2007-04-16 16:31 <a href="http://www.blogjava.net/etlan/archive/2007/04/16/111008.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>path 和 classpath区别</title><link>http://www.blogjava.net/etlan/archive/2006/07/03/56390.html</link><dc:creator>张秀兰</dc:creator><author>张秀兰</author><pubDate>Mon, 03 Jul 2006 09:26:00 GMT</pubDate><guid>http://www.blogjava.net/etlan/archive/2006/07/03/56390.html</guid><wfw:comment>http://www.blogjava.net/etlan/comments/56390.html</wfw:comment><comments>http://www.blogjava.net/etlan/archive/2006/07/03/56390.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/etlan/comments/commentRss/56390.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/etlan/services/trackbacks/56390.html</trackback:ping><description><![CDATA[<p>环境变量path和classpath是什么东东<br>path是您用的操作系统提供的环境变量，<br>您一定试过在命令行输入一个命令然后它就执行了，很好玩吧。你输入的比如说是〉ffff，<br>可这个文件明明在D:/****/***/ffff.exe那个路径下，在命令行中，不管在那个路径下输入都能执行呢，<br>这就是因为，再path中设置了这个路径。<br>那classpath有什么作用呢？编java程序的时候都知道import的作用吧！<br>当要用的class，在某一个.jar下是，你需要在编译时引入，jvm自动去找classpath环境变量引入下面的jar包，<br>这就是classpath环境变量的作用 <br><br><br>Path=.;C:\j2sdk1.4.2_05\bin;D:\DownLoads\oracle\bin;D:\DownLoads\oracle\Apache\Perl\5.00503\bin\mswin32-x86;C:\Program Files\Oracle\jre\1.1.7\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;D:\DownLoads;C:\Program Files\Symantec\pcAnywhere\;C:\Program Files\Microsoft SQL Server\80\Tools\BINN</p>
<p>JAVA_HOME=C:\j2sdk1.4.2_05</p>
<p>CLASSPATH=.\;%JAVA_HOME%\lib\tools.jar<br>(Path没有用到JAVA_HOME变量)</p><img src ="http://www.blogjava.net/etlan/aggbug/56390.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/etlan/" target="_blank">张秀兰</a> 2006-07-03 17:26 <a href="http://www.blogjava.net/etlan/archive/2006/07/03/56390.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>tomcat数据库连接池设置</title><link>http://www.blogjava.net/etlan/archive/2006/06/22/54497.html</link><dc:creator>张秀兰</dc:creator><author>张秀兰</author><pubDate>Thu, 22 Jun 2006 07:18:00 GMT</pubDate><guid>http://www.blogjava.net/etlan/archive/2006/06/22/54497.html</guid><wfw:comment>http://www.blogjava.net/etlan/comments/54497.html</wfw:comment><comments>http://www.blogjava.net/etlan/archive/2006/06/22/54497.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/etlan/comments/commentRss/54497.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/etlan/services/trackbacks/54497.html</trackback:ping><description><![CDATA[<p>以下是转帖:<br></p>
<table class=buttomBorder cellSpacing=3 cellPadding=3 width="100%" border=0>
    <tbody>
        <tr>
            <td class=contentTitle align=middle>
            <p align=justify>Tomcat 的数据库连接池设置与应用 </p>
            </td>
        </tr>
        <tr>
            <td align=middle>
            <p align=justify>&nbsp;</p>
            </td>
        </tr>
        <tr>
            <td class=content vAlign=top align=left>
            <p>1．将数据库驱动程序的JAR文件放在Tomcat的&nbsp;common/lib&nbsp;中；<br><br>2．在server.xml中设置数据源，以MySQL数据库为例，如下：<br>在&lt;GlobalNamingResources&gt;&nbsp;&lt;/GlobalNamingResources&gt;节点中加入，<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;Resource<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;name="jdbc/DBPool"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;type="javax.sql.DataSource"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;password="root"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;driverClassName="com.mysql.jdbc.Driver"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;maxIdle="2"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;maxWait="5000"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;username="root"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;url="jdbc:mysql://127.0.0.1:3306/test"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;maxActive="4"/&gt;<br>&nbsp;&nbsp;&nbsp;属性说明：name，数据源名称，通常取&#8221;jdbc/XXX&#8221;的格式；<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;type，&#8221;javax.sql.DataSource&#8221;;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;password，数据库用户密码；<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;driveClassName，数据库驱动；<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;maxIdle，最大空闲数，数据库连接的最大空闲时间。超过空闲时间，数据库连<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;接将被标记为不可用，然后被释放。设为0表示无限制。<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MaxActive，连接池的最大数据库连接数。设为0表示无限制。<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;maxWait&nbsp;，最大建立连接等待时间。如果超过此时间将接到异常。设为-1表示<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;无限制。<br><br>3．在你的web应用程序的web.xml中设置数据源参考，如下：<br>&nbsp;&nbsp;在&lt;web-app&gt;&lt;/web-app&gt;节点中加入，<br>&nbsp;&nbsp;&lt;resource-ref&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;MySQL&nbsp;DB&nbsp;Connection&nbsp;Pool&lt;/description&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;res-ref-name&gt;jdbc/DBPool&lt;/res-ref-name&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;res-type&gt;javax.sql.DataSource&lt;/res-type&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;res-auth&gt;Container&lt;/res-auth&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;res-sharing-scope&gt;Shareable&lt;/res-sharing-scope&gt;<br>&nbsp;&lt;/resource-ref&gt;<br>&nbsp;&nbsp;子节点说明：&nbsp;description，描述信息；<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;res-ref-name，参考数据源名字，同上一步的属性name；<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;res-type，资源类型，&#8221;javax.sql.DataSource&#8221;；<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;res-auth，&#8221;Container&#8221;；<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;res-sharing-scope，&#8221;Shareable&#8221;；<br><br>4．在web应用程序的context.xml中设置数据源链接，如下：<br>&nbsp;&nbsp;在&lt;Context&gt;&lt;/Context&gt;节点中加入，<br>&nbsp;&nbsp;&lt;ResourceLink<br>&nbsp;&nbsp;&nbsp;name="jdbc/DBPool"&nbsp;<br>&nbsp;&nbsp;&nbsp;type="javax.sql.DataSource"&nbsp;<br>&nbsp;&nbsp;&nbsp;global="jdbc/DBPool"/&gt;<br>&nbsp;&nbsp;&nbsp;属性说明：name，同第2步和第3步的属性name值，和子节点res-ref-name值；<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;type，同样取&#8221;javax.sql.DataSource&#8221;；<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;global，同name值。<br>&nbsp;<br>至此，设置完成，下面是如何使用数据库连接池。<br>1．建立一个连接池类，DBPool.java，用来创建连接池，代码如下：<br>import&nbsp;javax.naming.Context;<br>import&nbsp;javax.naming.InitialContext;<br>import&nbsp;javax.naming.NamingException;<br>import&nbsp;javax.sql.DataSource;<br><br>public&nbsp;class&nbsp;DBPool&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;private&nbsp;static&nbsp;DataSource&nbsp;pool;<br>&nbsp;&nbsp;&nbsp;&nbsp;static&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Context&nbsp;env&nbsp;=&nbsp;null;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;try&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;env&nbsp;=&nbsp;(Context)&nbsp;new&nbsp;InitialContext().lookup("java:comp/env");<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pool&nbsp;=&nbsp;(DataSource)env.lookup("jdbc/DBPool");<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(pool==null)&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.err.println("'DBPool'&nbsp;is&nbsp;an&nbsp;unknown&nbsp;DataSource");<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;catch(NamingException&nbsp;ne)&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ne.printStackTrace();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;static&nbsp;DataSource&nbsp;getPool()&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;pool;<br>&nbsp;&nbsp;&nbsp;&nbsp;}<br>}<br><br>2．在要用到数据库操作的类或jsp页面中，用DBPool.getPool().getConnection()，<br>获得一个Connection对象，就可以进行数据库操作，<br>最后别忘了对Connection对象调用close()方法，<br>注意：这里不会关闭这个Connection，而是将这个Connection放回数据库连接池。<br><br>也是可以直接连的：<br>如连接oracle<br>public class ConnectionProvider<br>{<br>&nbsp;public static DataSource ds;</p>
            <p>&nbsp;static <br>&nbsp;{<br>&nbsp;&nbsp;DriverAdapterCPDS cpds = new DriverAdapterCPDS();</p>
            <p>&nbsp;&nbsp;try<br>&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;cpds.setDriver("oracle.jdbc.driver.OracleDriver");<br>&nbsp;&nbsp;}<br>&nbsp;&nbsp;catch (ClassNotFoundException e)<br>&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;String msg = "Could not find driver in the classpath ";<br>&nbsp;&nbsp;&nbsp;System.out.println(msg);<br>&nbsp;&nbsp;&nbsp;throw new RuntimeException(msg);<br>&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;cpds.setUrl("jdbc:oracle:thin:@192.168.0.167:1521:epcora");<br>&nbsp;&nbsp;cpds.setUser("71c");<br>&nbsp;&nbsp;cpds.setPassword("123456");</p>
            <p>&nbsp;&nbsp;Jdbc2PoolDataSource tds = new Jdbc2PoolDataSource();<br>&nbsp;&nbsp;tds.setConnectionPoolDataSource(cpds);<br>&nbsp;&nbsp;tds.setDefaultMaxActive(20);<br>&nbsp;&nbsp;tds.setDefaultMaxWait(50);<br>&nbsp;&nbsp;<br>&nbsp;&nbsp;ds = tds;<br>&nbsp;}<br>}<br>这样就不用在server.xml,web.xml设置了。<br><br>还是若用eclipse跟踪bug，设置连接数据库则须在&#8220;Java构建路径&#8221;－&#8220;库&#8221;里添加上<br>数据库驱动程序的JAR文件即可。<br></p>
            </td>
        </tr>
    </tbody>
</table><img src ="http://www.blogjava.net/etlan/aggbug/54497.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/etlan/" target="_blank">张秀兰</a> 2006-06-22 15:18 <a href="http://www.blogjava.net/etlan/archive/2006/06/22/54497.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>