加入收藏 | 设为首页 | 会员中心 | 我要投稿 51站长网 (https://www.51zhanzhang.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
站内搜索:
当前位置: 首页 > 服务器 > 搭建环境 > Linux > 正文

awk - Unix, Linux Command---reference

发布时间:2021-01-26 15:34:41 所属栏目:Linux 来源:网络整理
导读: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-

Starting with version 3.1 of?gawk,the following functions may be used from within your AWK program for translating strings at run-time. For full details,see?GAWK: Effective AWK Programming.

directory?[,?domain]) gawk?looks for the?.mo?files,in case they will not or cannot be placed in the ‘‘standard’’ locations (e.g.,during testing). It returns the directory wheredomain?is ‘‘bound.’’

The default?domain?is the value of?TEXTDOMAIN. If?directory?is the null string (""),then?bindtextdomain()?returns the current binding for the given?domain.

string?[,?domain?[,?category]]) string?in text domain?domain?for locale category?category. The default value for?domain?is the current value of?TEXTDOMAIN. The default value for?category?is"LC_MESSAGES".

If you supply a value for?category,it must be a string equal to one of the known locale categories described in?GAWK: Effective AWK Programming. You must also supply a text domain. UseTEXTDOMAIN?if you want to use the current domain.

string1?,?string2?,?number?[,?category]]) number?of the translation ofstring1?and?string2?in text domain?domain?for locale categorycategory. The default value for?domain?is the current value ofTEXTDOMAIN. The default value for?category?is"LC_MESSAGES".

If you supply a value for?category,it must be a string equal to one of the known locale categories described in?GAWK: Effective AWK Programming. You must also supply a text domain. UseTEXTDOMAIN?if you want to use the current domain.

Functions in?AWK?are defined as follows:

function?name(parameter list) {?statements?}

Functions are executed when they are called from within expressions in either patterns or actions. Actual parameters supplied in the function call are used to instantiate the formal parameters declared in the function. Arrays are passed by reference,other variables are passed by value.

Since functions were not originally part of the?AWK?language,the provision for local variables is rather clumsy: They are declared as extra parameters in the parameter list. The convention is to separate local variables from real parameters by extra spaces in the parameter list. For example:

<table class="src" cellspacing="5" cellpadding="5">

<tr>
<td>

function  f(p,q,a,b)?????# a and b are local
{
????????...
}

/abc/???{ ... ; f(1,2) ; ... }

The left parenthesis in a function call is required to immediately follow the function name,without any intervening white space. This is to avoid a syntactic ambiguity with the concatenation operator. This restriction does not apply to the built-in functions listed above.

Functions may call each other and may be recursive. Function parameters used as local variables are initialized to the null string and the number zero upon function invocation.

Use?return?expr?to return a value from a function. The return value is undefined if no value is provided,or if the function returns by ‘‘falling off’’ the end.

If?--lint?has been provided,?gawk?warns about calls to undefined functions at parse time,instead of at run time. Calling an undefined function at run time is a fatal error.

The word?func?may be used in place of?function.

Beginning with version 3.1 of?gawk,you can dynamically add new built-in functions to the running?gawk?interpreter. The full details are beyond the scope of this manual page; see?GAWK: Effective AWK Programming?for the details.

(编辑:ASP站长)

【免责声明】本站内容转载自互联网,其相关言论仅代表作者个人观点绝非权威,不代表本站立场。如您发现内容存在版权问题,请提交相关链接至邮箱:bqsm@foxmail.com,我们将及时予以处理。

Description
相关内容
未处理完善
    无相关信息
未处理完善