![](https://img-blog.csdnimg.cn/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Shell实例
文章平均质量分 74
lionfun
这个作者很懒,什么都没留下…
展开
-
Sed 的man手册参数详细解释(二)
-i[SUFFIX], --in-place[=SUFFIX] edit files in place (makes backup if extension supplied) 就地编辑文件,如果指定了-i的值(suffix)sed将会备份一份原文件。 解释:就地编辑文件,如果没有该选项,sed将输出送入标准输出。该选项使sed将输出送入原来的输入文件中,一旦指定了后缀名suffix了以后,sed将备份原来的输入文件,该备份文件名以原文件名后接 suffix命令,如果想在原文件名和后缀suff原创 2010-12-12 17:40:00 · 2695 阅读 · 0 评论 -
awk教程
1. awk简介awk是一种编程语言,用于在linux/unix下对文本和数据进行处理。数据可以来自标准输入、一个或多个文件,或其它命令的输出。它支持用户自定义函数和动态正则表达式等先进功能,是linux/unix下的一个强大编程工具。它在命令行中使用,但更多是作为脚本来使用。awk的处理文本和数据的方式是这样的,它逐行扫描文件,从第一行到最后一行,寻找匹配的特转载 2011-06-05 15:01:00 · 1429 阅读 · 0 评论 -
我在Centos5.6 上安装支持802.11b g的无线网卡驱动的具体过程
通过 lsb_release -a命令可以看出我的linux的发行版是CentOS release 5.6 (Final) 默认是没有安装无线网卡驱动的,但是需要使用无线网,没办法,那要自己安装驱动了!我的笔记本是MSI U90/100 上网本,到官网查看了相关的信息,只显示了802.11b/g没有具体的商家信息,然后我通过lspci -v 查看到了我的网卡是Network controller: RaLink RT2860 到RaLink官网,很遗憾网站打不开,只能通过google搜索,找到了一个可以下载原创 2011-04-09 12:24:00 · 3121 阅读 · 0 评论 -
linux中shell变量$#,$@,$0,$1,$2的含义解释
<br />linux中shell变量$#,$@,$0,$1,$2的含义解释: <br />变量说明: <br />$$ <br />Shell本身的PID(ProcessID) <br />$! <br />Shell最后运行的后台Process的PID <br />$? <br />最后运行的命令的结束代码(返回值) <br />$- <br />使用Set命令设定的Flag一览 <br />$* <br />所有参数列表。如"$*"用「"」括起来的情况、以"$1 $2 … $n"的形式输出所有参数。原创 2011-03-17 22:49:00 · 3895 阅读 · 1 评论 -
Sed的 man手册参数详细解释(十)
Addresses Sed commands can be given with no addresses, in which case the command will be executed for all input lines; with one address, in which case the command will only be executed for input lines which match that address; or with two addresses, in原创 2010-12-12 18:04:00 · 969 阅读 · 0 评论 -
Sed的 man手册参数详细解释(九)
P(小写) Print the current pattern space. 打印当前模式空间(Pattern space)中的全部内容。 P(大写) Print up to the first embedded newline of the current pattern space. 打印当前模式空间(Pattern space)中内容的第一行数据。 提示:之前说过模式空间是可以存在多行数据的,p(小写)和P(大写)作用不同在于,前者打印全部,而后者只打印第一行。 / +++++原创 2010-12-12 18:03:00 · 837 阅读 · 0 评论 -
Sed 的man手册参数详细解释(四)
COMMAND SYNOPSIS This is just a brief synopsis of sed commands to serve as a reminder to those who already know sed; other documentation (such as the texinfo document) must be consulted for fuller descriptions. 中文翻译:以下内容作为一个简短的梗概,仅仅对那些已经知道sed的人做一个提示,如果你原创 2010-12-12 17:49:00 · 1044 阅读 · 0 评论 -
Sed 的man手册参数详细解释(三)
-l N, --line-length=N specify the desired line-wrap length for the ‘l’ command 也就是说如果后面的command中如果有l(是英文L的小写),就可以通过这里的-l选项来指定每一行的显示长度,默认是70个字符,如果超过,将会通过跳脱字符“/”来换行。例如 sed -n -l 10 '1,2l' textfile 将第一和第二行按每行10个字符显示,包括转义字符。 注意:该选项必须要与后面的 –e 指定的指令l一起用。原创 2010-12-12 17:47:00 · 1120 阅读 · 0 评论 -
Sed 的man手册参数详细解释(一)
NAME sed - stream editor for filtering and transforming text SYNOPSIS sed [OPTION]... {script-only-if-no-other-script} [input-file]... DESCRIPTIONSed is a stream editor. A stream editor is used to perform basic text transformations on an input stre原创 2010-12-12 17:45:00 · 4688 阅读 · 0 评论 -
Sed 的man手册参数详细解释(八)
g G Copy/append hold space to pattern space. 将保留空间(Hold space)的数据复制/追加到模式空间(Pattern space)中。 提示:原理同h/H,只是内容传输方向相反,不多说了。 / +++++++++++++++++++++++++++++++++++++++例子23+++++++++++++++++++++++++++++++++++++ sed.txt的内容为: This is a dog. This is a ca原创 2010-12-12 18:01:00 · 1003 阅读 · 0 评论 -
Sed 的man手册参数详细解释(七)
d Delete pattern space. Start next cycle. 删除模式空间中的全部行,继续进行下一行。 D Delete up to the first embedded newline in the pattern space. Start next cycle, but skip reading from the input if there is still data in the pattern space. 在模式空间中删除掉第一行文本,开始从input中读取下一行,原创 2010-12-12 17:59:00 · 847 阅读 · 0 评论 -
Sed的 man手册参数详细解释(六)
Commands which accept address ranges { Begin a block of commands (end with a }). 接受地址范围的命令 b label Branch to label; if label is omitted, branch to end of script. 将控制分支到标签,如果标签被忽略,将控制分支到脚本后面。 解释:b指令是针对脚本的控制流来说的,意思就是它是用来转移控制,将当前的数据行传到b指令指定的标签后面,标签后的原创 2010-12-12 17:52:00 · 988 阅读 · 0 评论 -
Sed 的man手册参数详细解释(五)
Zero- or One- address commands 不用地址或者只需要一个地址的命令 = Print the current line number. 输出当前处理行的行号。 补充:不管是空行还是非空行,“=”命令都会自动在当前处理的行的前另做一行显示当前行号。 / +++++++++++++++++++++++++++++++++++++++例子11+++++++++++++++++++++++++++++++++++++ sed.txt的内容为: red hat is原创 2010-12-12 17:50:00 · 1101 阅读 · 0 评论 -
一个通过不同的文件扩展名来调用不同的解压程序的shell脚本
该脚本是可以判断传来的文件名,然后通过不同的文件扩展名来调用不同的解压程序;该脚本比较有特点的是在文件名处理的时候。 #!/bin/bashUNPACK=1if [ ${1##*.} = bz2 ] ; then TEMP=${1%.*} if [ ${TEMP##*.} = tar ] ; then tar原创 2011-06-06 01:05:00 · 2344 阅读 · 1 评论