awk study(4)
来源:互联网 发布:java jsonarray 添加 编辑:程序博客网 时间:2024/04/30 18:55
1.1.5 comments in awk programs
A comment is some text that is included in a program for the sake of human readers;it is not really an executable part of the program,comments can explain what's the program does and how it works.Nearly all programming languages have provisions for comments, as programs are typically hard to understand without comments.
In the awk programs, a comment starts with the sharp sign character("#") and continus to the end of the line, The "#" does't have to be the first character on the line,the awk language ignores the rest of the line following a sharp sign. For example,we could have put the following into advice file:
Caution: As mentioned in One-shot, you can enclose small to medium programs in single quotes, in order to keep your shell scripts self-contained.When doing so, don't put a apostrophe(i.e.,sigle quote)into a comment(or anywhere else at your program). The shell interprets the quotes as the closing quotes for the entire program. As a result, usually the shell prints a message about mismatched quotes,and if awk actually runs, it will probably print strange messages about syntax errors.For example, look at the following:
A comment is some text that is included in a program for the sake of human readers;it is not really an executable part of the program,comments can explain what's the program does and how it works.Nearly all programming languages have provisions for comments, as programs are typically hard to understand without comments.
In the awk programs, a comment starts with the sharp sign character("#") and continus to the end of the line, The "#" does't have to be the first character on the line,the awk language ignores the rest of the line following a sharp sign. For example,we could have put the following into advice file:
# This program prints a nice friendly message. It helpsYou can put comment lines into keyboard-composed throwaway awk programs, but this usually is not very useful; the purpose of a comment is help you or another person understand the program when reading it at a later time.
# keep novice users from being afraid of the computer.
BEGIN { print "Don't Panic!" }
Caution: As mentioned in One-shot, you can enclose small to medium programs in single quotes, in order to keep your shell scripts self-contained.When doing so, don't put a apostrophe(i.e.,sigle quote)into a comment(or anywhere else at your program). The shell interprets the quotes as the closing quotes for the entire program. As a result, usually the shell prints a message about mismatched quotes,and if awk actually runs, it will probably print strange messages about syntax errors.For example, look at the following:
$ awk '{ print "hello" } # let's be cute'The shell sees that the first two quotes match, and that a new quoted object begins at the end of command line,it therefore prompts with the secondary, waiting for more input. With unix awk, closing the quoted string produce this result:
>
$ awk '{ print "hello" } # let's be cute'Putting a backslash before the single quote in "let's "wouldn't help, since backslashs are not spcial inside sigle quotes. The next subsection describes the shell's quoting rules.
> '
error--> awk: can't open file be
error--> source line number 1
- awk study(4)
- awk study(1)
- awk study(2)
- awk study(3)
- awk study(5)
- awk study(6)
- awk study(7)
- awk study(9)
- awk study(10)
- awk study(11)
- AWK study note
- awk(4)-awk介绍
- awk-4
- VBA Study(4)
- OpenGL Study 4
- Vim Tutorial Study(4)
- vc-study-4
- jQuery study note 4
- 在一个存储过程中调用返回一个游标的另一个存储过程
- 得到数据库中所有的表以及表字段
- 如何配置驱动程序开发环境
- Hibernate的lazy问题
- 说一说等价关系
- awk study(4)
- aspjpeg 注册码和注册方法
- 次级贷!
- 什么是交叉编译(转)
- XSDL教程[w3c]
- FLASH全屏播放
- 大乘佛教与小乘佛教之区别
- 用lucene做一个站内搜索引擎(一):用ictclas4j做Lucene系统的分词器:(1)提高词典加载速度.
- shawl.qiu javascript 表单列表框联动类 v1.0 (支持无限级联动)