加入收藏 | 设为首页 | 会员中心 | 我要投稿 网站开发网_马鞍山站长网 (https://www.0555zz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长百科 > 正文

awk - Unix, Linux Command---reference

发布时间:2021-01-29 04:45:02 所属栏目:站长百科 来源:网络整理
导读:副标题#e# http://www.tutorialspoint.com/unix_commands/awk.htm gawk - pattern scanning and processing language gawk?[?POSIX?or?GNU?style options ]?-f? program-file ?[?--?] file ...?gawk?[?POSIX?or?GNU?style options ] [?--?]? program-text ?

This function is provided and documented in?GAWK: Effective AWK Programming,but everything about this feature is likely to change in the next release. We STRONGLY recommend that you do not use this feature for anything that you aren’t willing to redo.

pgawk?accepts two signals.?SIGUSR1?causes it to dump a profile and function call stack to the profile file,which is either?awkprof.out,or whatever file was named with the?--profile?option. It then continues to run.?SIGHUP?causes it to dump the profile and function call stack and then exit.

Print and sort the login names of all users:

????????BEGIN???{ FS = ":" } ????????????????{ print $1 | "sort" }

Count lines in a file:

????????????????{ nlines++ } ????????END?????{ print nlines }

Precede each line by its number in the file:

????????{ print FNR,$0 }

Concatenate and line number (a variation on a theme):

????????{ print NR,$0 } Run an external command for particular lines of data:

????????tail -f access_log | ????????awk ’/myhome.html/ { system("nmap " $1 ">> logdir/myhome.html") }’

String constants are sequences of characters enclosed in double quotes. In non-English speaking environments,it is possible to mark strings in the?AWK?program as requiring translation to the native natural language. Such strings are marked in the?AWK?program with a leading underscore (‘‘_’’). For example,

gawk ’BEGIN { print "hello,world" }’

always prints?hello,world. But,

gawk ’BEGIN { print _"hello,world" }’

might print?bonjour,monde?in France.

There are several steps involved in producing and running a localizable?AWK?program.

? ?BEGIN { TEXTDOMAIN = "myprog" }

(编辑:网站开发网_马鞍山站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

Description