LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 951|回复: 5

shell语句疑问

[复制链接]
发表于 2006-4-12 14:08:31 | 显示全部楼层 |阅读模式
echo SIDLIST `awk -F: '/^[^#]/ {printf "%s ",$1} ' /var/opt/oracle/oratab

我想问一下这句是什么意思

这是加在/home/oracle/.bash_profile 文件中用来起启多实例的。

谢谢
发表于 2006-4-12 22:27:21 | 显示全部楼层
seems like you lost the last `. but I think what it means is to echo SIDLIST and the result of $1 after awking oratab file. (: as the FS and not line start from #)
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-4-13 11:22:47 | 显示全部楼层
Tks.

我想知道  awk -F: '/^[^#]/ {printf "%s ",$1}'

是什么意思。

辛苦,嘿嘿
回复 支持 反对

使用道具 举报

发表于 2006-4-13 12:44:46 | 显示全部楼层
an awk cmd:
1. -F: means set the delimiter to :
2. /^[^#]/ : pattern match using regex, meaning lines starting from no #.
3. {printf "%s", $1}: a format print for field 1.
Suggest you take a look some basic sed/awk threads in this forum.
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-4-13 13:33:21 | 显示全部楼层
Post by yongjian
an awk cmd:
1. -F: means set the delimiter to :
2. /^[^#]/ : pattern match using regex, meaning lines starting from no #.
3. {printf "%s", $1}: a format print for field 1.
Suggest you take a look some basic sed/awk threads in this forum.


和regex[匹配,regex是什么呢?
starting from no #。 从no#开始? no #是什么?

$1是变量,那%s呢?

我在看awk和sed教程

谢谢,还有个问题我想请教一下,关于stopweblogic.sh这个shell的。

嘿嘿,麻烦了
回复 支持 反对

使用道具 举报

发表于 2006-4-13 22:25:07 | 显示全部楼层
Post by soccer
和regex[匹配,regex是什么呢?
starting from no #。 从no#开始? no #是什么?

$1是变量,那%s呢?

我在看awk和sed教程

谢谢,还有个问题我想请教一下,关于stopweblogic.sh这个shell的。

嘿嘿,麻烦了


1。regex是指正则表达式
2。$1是指以即-F:所以指定的)分割的文件中的每一行的第一列,%s是表示将$1列的值以字符串显示
3。starting from no # 是指第一个字符为非#字符

如同yongjian兄建议的,soccer兄可以看看linuxsir中的精华贴或者man手册,其实都可以找到。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表