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

awk - Unix, Linux Command---reference

发布时间:2021-01-24 20:35:25 所属栏目: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>
<th width="25%">Tag

s?[,?d]) s. The contents of?s?are sorted using?gawk’s normal rules for comparing values,and the indexes of the sorted values of?s?are replaced with sequential integers starting with 1. If the optional destination array?d?is specified,then?s?is first duplicated into?d,and then?d?is sorted,leaving the indexes of the source array?sunchanged.s?[,?d]) s. The behavior is the same as that of?asort(),except that the arrayindices?are used for sorting,not the array values. When done,the array is indexed numerically,and the values are those of the original indices. The original values are lost; thus provide a second array if you wish to preserve the original.r,?s,?h?[,?t]) t?for matches of the regular expressionr. If?h?is a string beginning with?g?or?G,then replace all matches of?r?with?s. Otherwise,?h?is a number indicating which match of?rto replace. If?t?is not supplied,?$0?is used instead. Within the replacement text?s,the sequence?n,where?n?is a digit from 1 to 9,may be used to indicate just the text that matched the?n’th parenthesized subexpression. The sequence??represents the entire matched text,as does the character?&. Unlike?sub()?andgsub(),the modified string is returned as the result of the function,and the original target string is?not?changed.r,?s?[,?t]) r?in the string?t,substitute the string?s,and return the number of substitutions. If?t?is not supplied,use?$0. An?&?in the replacement text is replaced with the text that was actually matched. Use?&;?to get a literal?&. (This must be typed as"&"; see?GAWK: Effective AWK Programming?for a fuller discussion of the rules for?&’s?and backslashes in the replacement text of?sub(),and?gensub().)s,?t) t?in the string?s,or 0 if?t?is not present. (This implies that character indices start at one.)s]) s,or the length of?$0?if?s?is not supplied. Starting with version 3.1.5,as a non-standard extension,with an array argument,?length()?returns the number of elements in the array.s,?r?[,?a]) s?where the regular expression?r?occurs,or 0 if?r?is not present,and sets the values of?RSTART?andRLENGTH. Note that the argument order is the same as for the~?operator:?str?~?re. If array?a?is provided,?a?is cleared and then elements 1 through?n?are filled with the portions of?s?that match the corresponding parenthesized subexpression in?r. The 0’th element of?a?contains the portion of?s?matched by the entire regular expression?r. Subscripts?a[n,"start"],and?a[n,"length"]?provide the starting index in the string and length respectively,of each matching substring.s,?a?[,?r]) s?into the array?a?on the regular expression?r,and returns the number of fields. If?r?is omitted,?FS?is used instead. The array?a?is cleared first. Splitting behaves identically to field splitting,described above.fmt,?expr-list) expr-list?according to?fmt,and returns the resulting string.str) str,and returns its numeric value. If?str?begins with a leading?0,?strtonum()?assumes that?str?is an octal number. Ifstr?begins with a leading?0x?or?0X,?strtonum()?assumes thatstr?is a hexadecimal number.r,?t]) s,?i?[,?n]) n-character substring of?s?starting at?i. If?nis omitted,the rest of?s?is used.str) str,with all the upper-case characters in?str?translated to their corresponding lower-case counterparts. Non-alphabetic characters are left unchanged.str) str,with all the lower-case characters in?str?translated to their corresponding upper-case counterparts. Non-alphabetic characters are left unchanged.Time Functions

(编辑:晋中站长网)

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

<table class="src" border="1" cellspacing="0" cellpadding="5">

Description
热点阅读