Running awk Without Input Files【每日一译】--20130204

You can also runawk without any input files. If you type the following command line:

可以没有输入文件参数的使用AWK,如果你输入以下的命令行:

     awk 'program'

awk applies the program to the standard input, which usually means whatever you type on the terminal. This continues until you indicate end-of-file by typingCtrl-d. (On other operating systems, the end-of-file character may be different. For example, on OS/2, it isCtrl-z.)

awk编程对应用于标准输入,一般是指我们经常输入在终端的内容。它持续到你输入结束文件的指示命令通过输入”CTRL-D“(在其它操作系统,结束文件的标识符可能不同如在OS/2操作系统中为"CTRL-Z";

As an example, the following program prints a friendly piece of advice (from Douglas Adams'sThe Hitchhiker's Guide to the Galaxy), to keep you from worrying about the complexities of computer programming7 (BEGIN is a feature we haven't discussed yet):

举例,以下的程序输入一个友好的提示条,为了让于免于担心复杂的电脑编程(BEGIN是一个功能目前我们还未讨论到):

     $ awk "BEGIN { print \"Don't Panic!\" }"
     -| Don't Panic!

This program does not read any input. The ‘\’ before each of the inner double quotes is necessary because of the shell's quoting rules—in particular because it mixes both single quotes and double quotes.8

这个程序不读入任何输入文件。“\"符号在每个内双引前是必须的,因为在SHELL中的引号语法规定的---尤其是它混合了双引和单引的情况;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值