加入收藏 | 设为首页 | 会员中心 | 我要投稿 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-
</tr>
<tr valign="top">
<td>RS</td>
<td valign="bottom">The input record separator,by default a newline.</td>

</tr>
<tr valign="top">
<td>RT</td>
<td valign="bottom">The record terminator.?Gawk?sets?RT?to the input text that matched the character or regular expression specified by?RS.</td>

</tr>
<tr valign="top">
<td>RSTART</td>
<td valign="bottom">The index of the first character matched by?match(); 0 if no match. (This implies that character indices start at one.)</td>

</tr>
<tr valign="top">
<td>RLENGTH</td>
<td valign="bottom">The length of the string matched by?match(); -1 if no match.</td>

</tr>
<tr valign="top">
<td>SUBSEP</td>
<td valign="bottom">The character used to separate multiple subscripts in array elements,by default?"34".</td>

</tr>
<tr valign="top">
<td>TEXTDOMAIN</td>
<td valign="bottom">The text domain of the?AWK?program; used to find the localized translations for the program’s strings.</td>

</tr>

Arrays

Arrays are subscripted with an expression between square brackets ([?and?]). If the expression is an expression list (expr,?expr?...) then the array subscript is a string consisting of the concatenation of the (string) value of each expression,separated by the value of the?SUBSEP?variable. This facility is used to simulate multiply dimensioned arrays. For example:

i = "A"; j = "B"; k = "C"?x[i,j,k] = "hello,worldn"

assigns the string?"hello,worldn"?to the element of the array?x?which is indexed by the string?"A34B34C". All arrays in?AWK?are associative,i.e. indexed by string values.

The special operator?in?may be used in an?if?or?while?statement to see if an array has an index consisting of a particular value.

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

<tr>
<td>

if (val in array)
????????print array[val]
If the array has multiple subscripts,use?(i,j) in array.

The?in?construct may also be used in a?for?loop to iterate over all the elements of an array.

An element may be deleted from an array using the?delete?statement. The?deletestatement may also be used to delete the entire contents of an array,just by specifying the array name without a subscript.

Variable Typing And Conversion

Variables and fields may be (floating point) numbers,or strings,or both. How the value of a variable is interpreted depends upon its context. If used in a numeric expression,it will be treated as a number,if used as a string it will be treated as a string.

To force a variable to be treated as a number,add 0 to it; to force it to be treated as a string,concatenate it with the null string.

(编辑:ASP站长)

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

</tr>
<tr valign="top">
<td>PROCINFO["FS"]</td>
<td valign="bottom">
"FS"?if field splitting with?FS?is in effect,or?"FIELDWIDTHS"?if field splitting with?FIELDWIDTHS?is in effect.</td>

</tr>
<tr valign="top">
<td>PROCINFO["gid"]</td>
<td valign="bottom">the value of the?getgid(2) system call.</td>

</tr>
<tr valign="top">
<td>PROCINFO["pgrpid"]</td>
<td valign="bottom">the process group ID of the current process.</td>

</tr>
<tr valign="top">
<td>PROCINFO["pid"]</td>
<td valign="bottom">the process ID of the current process.</td>

</tr>
<tr valign="top">
<td>PROCINFO["ppid"]</td>
<td valign="bottom">the parent process ID of the current process.</td>

</tr>
<tr valign="top">
<td>PROCINFO["uid"]</td>
<td valign="bottom">the value of the?getuid(2) system call.</td>

</tr>
<tr valign="top">
<td colspan="2">PROCINFO["version"]</td>

</tr>
<tr valign="top">
<td width="17%">?</td>
<td>The version of?gawk. This is available from version 3.1.4 and later.</td>

</tr>

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