2011年10月14日

摘要: 第一个 awk让我们继续,开始使用 awk,以了解其工作原理。在命令行中输入以下命令:$ awk '{ print }' /etc/passwd您将会见到 /etc/passwd 文件的内容出现在眼前。现在,解释 awk 做了些什么。调用 awk 时,我们指定 /etc/passwd 作为输入文件。执行 awk 时,它依次对 /etc/passwd 中的每一行执行 print 命令。所有输出都发送到 stdout,所得到的结果与与执行catting /etc/passwd完全相同。现在,解释 { print } 代码块。在 awk 中,花括号用于将几块代码组合到一起,这一点类似 阅读全文
posted @ 2011-10-14 23:32 sunleecn 阅读(1083) 评论(0) 推荐(0) 编辑
 
摘要: I. Sed Substitution DelimiterAs we discussed in our previous post, we can use the different delimiters such as @ % | ; : in sed substitute command.Let us first create path.txt file that will be used in all the examples mentioned below.$ cat path.txt/usr/kbos/bin:/usr/local/bin:/usr/jbin:/usr/bin:/us 阅读全文
posted @ 2011-10-14 23:28 sunleecn 阅读(437) 评论(0) 推荐(0) 编辑
 
摘要: simple awk tutorialwhy awk?awk is small, fast, and simple, unlike, say, perl. awk also has a clean comprehensible C-like input language, unlike, say, perl. And while it can't do everything you can do in perl, it can do most things that are actually text processing, and it's much easier to wo 阅读全文
posted @ 2011-10-14 23:25 sunleecn 阅读(148) 评论(0) 推荐(0) 编辑