📄 awk.9
字号:
%!PS-Adobe-1.0%%Creator: devps (Pipeline Associates, Inc.)%%CreationDate: Fri Sep 13 14:26:35 1996%%Pages: (atend)%%DocumentFonts: (atend)/devps 180 dict def devps begin/res 10.000000 def/y_offset 843 def/X{exch}bind def/mm {transform round X round X itransform} bind def/r{rmoveto}bind def/m{moveto}bind def/l{lineto}bind def/rl{rlineto}bind def/st{stroke}bind def/gs{gsave}bind def/gr{grestore}bind def/cp{currentpoint}bind def/np{newpath}bind def/ct{curveto}bind defsystemdict /setpacking known { /savepacking currentpacking def true setpacking } if/m0{0 0 moveto}bind def/xc{//res div}bind def/yc{//res neg div //y_offset add}bind def/lc{yc X xc X l st}bind def/mc{yc X xc X m}bind def/el{gs /a X def a div 1 X scale cp np a xc 2 div 0 360 arc st gr}bind def/ar{cp 7 2 roll np xc 5 1 roll atan 3 1 roll atan X arc st}bind def/sp{yc X xc X 6 2 roll yc X xc X 6 2 roll yc X xc X 6 2 roll ct}bind def/V{//res neg div //y_offset addcurrentpoint pop Xm}bind def/H{//res div0 transform X round X itransform popcurrentpoint X popmoveto}bind def/h{//res div 0 r}bind def/v{//res neg div 0 X r}bind def/S{X H show}bind def/A{H //res div 1 index stringwidth pop sub 1 index length div 0 3 2 roll ashow}bind def/psize 10 def/height 0 def/cheight { height 0 ne { height } { psize } ifelse } bind def/slant 0 def/FF{findfont X dup 30 div 0 mm pop setlinewidth /psize X def [psize 0 cheight slant sin slant cos div mul cheight 0 0] makefont setfont}bind def/shade{gs /dy X def /dx X def np m 0 /dy rl /dx 0 rl 0 /dy neg rl /dx neg 0 rl closepath .9 setgray fillgr}bind def1 setlinecap/resolution res 72 mul def/startFig { /SavedState save def userdict maxlength dict begin currentpoint transform DocumentInitState setmiterlimit setgray setdash setlinejoin setlinecap setlinewidth setmatrix itransform moveto /ury exch def /urx exch def /lly exch def /llx exch def /y exch 72 mul resolution div def /x exch 72 mul resolution div def currentpoint /cy exch def /cx exch def /sx x urx llx sub div def /sy y ury lly sub div def sx sy scale cx sx div llx sub cy sy div ury sub translate /DefFigCTM matrix currentmatrix def /initmatrix { DefFigCTM setmatrix } def /defaultmatrix { DefFigCTM exch copy } def /initgraphics { DocumentInitState setmiterlimit setgray setdash setlinejoin setlinecap setlinewidth setmatrix DefFigCTM setmatrix } def /showpage { initgraphics } def}bind def/clipFig { currentpoint 6 2 roll newpath 4 copy 4 2 roll moveto 6 -1 roll exch lineto exch lineto exch lineto closepath clip newpath moveto}bind def/doclip { llx lly urx ury clipFig } def/endFig { end SavedState restore}bind def/globalstart { fontnum psize slant height resolution currentpoint pagesave restore gsave }bind def/globalend { grestore moveto /resolution exch def /height exch def /slant exch def /psize exch def /fontnum exch def F /pagesave save def}bind def/fontnum 1 def systemdict /setpacking known { savepacking setpacking} ifend/BP{save mark devps begin m0/DocumentInitState [ matrix currentmatrix currentlinewidth currentlinecapcurrentlinejoin currentdash currentgray currentmiterlimit ] cvx def}bind def/EP{end cleartomark restore showpage}def/R{/Times-Roman FF}def/B{/Times-Bold FF}def/I{/Times-Italic FF}def/L{/Helvetica FF}def%%EndProlog%%Page: 1 1BP/slant 0 def/height 0 def858 V12 B936(Command:)S1584(awk)S1829(\261)S1919(pattern)S2333(matching)S2847(language)S996 V936(Syntax:)S1584(awk)S12 I1829(rules)S12 R2101([)S12 I2142(\256le)S12 R2290(])S(...)90 2361 A1134 V12 B936(Flags:)S12 R(\(none\))316 1584 A1272 V12 B936(Examples:)S12 R1584(awk)S1816(rules)S(input)248 2082 A2916(#)S3006(Process)S12 I(input)248 3406 A12 R(according)477 3684 A4191(to)S12 I4315(rules)S1410 V12 R1584(awk)S1816(rules)S2082(\261)S2202(>out)S2916(#)S(Input)255 3006 A3291(from)S3557(terminal,)S4022(output)S4360(to)S12 I4484(out)S1584 V12 R1116(AWK)S1442(is)S1560(a)S1651(programming)S(language)436 2346 A2819(devised)S3225(by)S3382(Aho,)S3657(Weinberger,)S4296(and)S4507(Kernighan)S1722 V936(at)S1061(Bell)S1300(Labs)S1572(\(hence)S1932(the)S2117(name\).)S12 I2517(Awk)S12 R2762(programs)S3256(search)S3602(\256les)S3840(for)S4018(speci\256c)S4424(patterns)S4844(and)S1860 V936(performs)S1425(`)S1456(`actions')S1871(')S1963(for)S2156(every)S2476(occurrence)S3059(of)S3211(these)S3512(patterns.)S4008(The)S4248(patterns)S4684(can)S4904(be)S1998 V936(`)S967(`regular)S1394(expressions')S1989(')S2072(as)S2215(used)S2478(in)S2613(the)S12 I2802(ed)S12 R2957(editor.)S3341(The)S3570(actions)S3954(are)S4144(expressed)S4662(using)S4964(a)S2136 V936(subset)S1268(of)S1399(the)S1577(C)S(language.)466 1687 A2310 V1116(The)S1343(patterns)S1766(and)S1979(actions)S2361(are)S2549(usually)S(placed)316 2937 A3292(in)S3425(a)S3518(`)S3549(`rules')S3857(')S3937(\256le)S4132(whose)S4481(name)S4783(must)S2448 V936(be)S1088(the)S1273(\256rst)S1499(argument)S1993(in)S2124(the)S2309(command)S2822(line,)S(preceded)437 3071 A3545(by)S3702(the)S3887(\257ag)S12 B4105(\261f)S12 R4206(.)S4303(Otherwise,)S4870(the)S2586 V936(\256rst)S1155(argument)S1642(on)S1792(the)S1970(command)S2476(line)S2688(is)S2799(taken)S3091(to)S3215(be)S3359(a)S3443(string)S3749(containing)S4289(the)S4468(rules)S4735(them-)S2724 V936(selves.)S1293(All)S1480(other)S1760(arguments)S2295(are)S2475(taken)S2768(to)S2892(be)S3036(the)S3214(names)S3553(of)S3684(text)S3896(\256les)S4128(on)S4278(which)S4604(the)S4782(rules)S2862 V936(are)S1122(to)S1253(be)S1404(applied,)S1827(with)S12 B2080(\261)S12 R2177(being)S2482(the)S2668(standard)S(input.)278 3116 A3462(To)S3634(take)S3874(rules)S4148(from)S4422(the)S4608(standard)S3000 V(input,)278 936 A1244(use)S12 B1435(\261f)S1566(\261)S12 R1626(.)S3174 V1116(The)S1334(command:)S3381 V10 L1086(awk)S1321(rules)S1596(prog.)S3431 V12 L1826(*)S3588 V12 R936(would)S1278(read)S1527(the)S1715(patterns)S2139(and)S2353(actions)S2736(rules)S3012(from)S3288(the)S3476(\256le)S12 I3671(rules)S12 R3954(and)S4169(apply)S4478(them)S4761(to)S4896(all)S3726 V936(the)S1114(arguments.)S3900 V1116(The)S1334(general)S1721(format)S2075(of)S2206(a)S2290(rules)S2556(\256le)S2741(is:)S4107 V1026(<pattern>)S1529({)S1617(<action>)S2079(})S2257(<pattern>)S2760({)S2848(<action>)S3310(})S(...)90 3488 A4314 V936(There)S1261(may)S1511(be)S1667(any)S1883(number)S2294(of)S2437(these)S2728(<pattern>)S3244({)S3345(<action>)S3820(})S3921(sequences)S4454(in)S4591(the)S4782(rules)S4452 V936(\256le.)S12 I1194(Awk)S12 R1445(reads)S1744(a)S1841(line)S2066(of)S(input)248 2210 A2501(from)S2780(the)S2971(current)S(input)248 3358 A3649(\256le)S3847(and)S4064(applies)S4450(every)S4761(<pat-)S4590 V936(tern>)S1223({)S1311(<action>)S1773(})S1861(in)S1985(sequence)S2458(to)S2582(the)S2760(line.)S4764 V1116(If)S1250(the)S1450(<pattern>)S(corresponding)691 1975 A2718(to)S2864(any)S3090({)S3200(<action>)S3684(})S3794(is)S3928(missing,)S4387(the)S4588(action)S4937(is)S4902 V936(applied)S1323(to)S1448(every)S1748(line)S1961(of)S(input.)278 2093 A2432(The)S2651(default)S3019({)S3108(<action>)S3570(})S3658(is)S3769(to)S3893(print)S4152(the)S4330(matched)S(input)248 4770 A5040 V936(line.)S5316 V12 B936(Patterns)S5628 V12 R1116(The)S1336(<pattern>s)S1888(may)S2128(consist)S2496(of)S2629(any)S2835(valid)S3110(C)S3223(expression.)S3833(If)S3948(the)S4129(<pattern>)S4635(consists)S5766 V936(of)S1070(two)S1285(expressions)S1882(separated)S2373(by)S2526(a)S2613(comma,)S3032(it)S3133(is)S3247(taken)S3541(to)S3667(be)S3813(a)S3899(range)S4200(and)S4406(the)S4586(<action>)S5904 V936(is)S1066(performed)S1620(on)S1789(all)S1960(lines)S2238(of)S(input)248 2388 A2685(that)S2916(match)S3261(the)S3458(range.)S3836(<pattern>s)S4405(may)S4662(contain)S6042 V936(`)S967(`regular)S1411(expressions')S2006(')S2106(delimited)S2622(by)S2800(an)S2972(@)S3142(symbol.)S3615(Regular)S4056(expressions)S4678(can)S4904(be)S6180 V(thought)368 936 A1341(of)S1479(as)S1617(a)S1708(generalized)S2304(`)S2335(`wildcard')S2832(')S2910(string)S3223(matching)S3710(mechanism,)S4328(similar)S4704(to)S4836(that)S6318 V936(used)S1204(by)S1371(many)S1686(operating)S2190(systems)S2619(to)S2759(specify)S3155(\256le)S3356(names.)S3771(Regular)S4200(expressions)S4810(may)S6456 V936(contain)S1322(any)S1526(of)S1657(the)S1835(following)S2336(characters:)S6663 V1116(x)S1476(An)S1654(ordinary)S2094(character)S6801 V1116(\\)S1476(The)S1694(backslash)S(quotes)315 2194 A2539(any)S2743(character)S6939 V1116(\303)S1476(A)S1594(circum\257ex)S2142(at)S2260(the)S2438(beginning)S2950(of)S3081(an)S3225(expr)S3470(matches)S3897(the)S4075(beginning)S4587(of)S4718(a)S4802(line.)S7077 V1116($)S1476(A)S1594(dollar-sign)S2149(at)S2267(the)S2445(end)S2649(of)S2780(an)S2924(expression)S3471(matches)S3898(the)S4076(end)S4280(of)S4411(a)S4495(line.)S8427 VEP%%Page: 2 2BP/slant 0 def/height 0 def1130 V12 B936(2)S1380 V12 R1116(.)S1476(A)S1594(period)S1933(matches)S2360(any)S2564(single)S2883(character)S3359(except)S3705(newline.)S1518 V1116(*)S1476(An)S1654(expression)S2201(followed)S2662(by)S2812(an)S2957(asterisk)S3359(matches)S3787(zero)S4027(or)S4159(more)S4439(occurrences)S1656 V1476(of)S1607(that)S1819(expression:)S2400(`)S2431(`fo*')S2664(')S2735(matches)S3162(`)S(`f')123 3193 A3306(',)S3407(`)S3438(`fo')S3611(',)S3712(`)S3743(`foo')S3976(',)S4077(`)S(`fooo')303 4108 A4401(',)S4502(etc.)S1794 V1116(+)S1476(An)S1657(expression)S2207(followed)S2671(by)S2824(a)S2912(plus)S3147(sign)S3382(matches)S3813(one)S4021(or)S4156(more)S4439(occurrences)S1932 V1476(of)S1607(that)S1819(expression:)S2400(`)S2431(`fo+')S2672(')S2743(matches)S3170(`)S3201(`fo')S3374(',)S3475(`)S3506(`foo')S3739(',)S3840(`)S(`fooo')303 3871 A4164(',)S4265(etc.)S2070 V1116([])S1476(A)S1596(string)S1904(enclosed)S2359(in)S2485(square)S2834(brackets)S3271(matches)S3701(any)S3908(single)S4230(character)S4709(in)S4836(that)S2208 V1476(string,)S1824(but)S2020(no)S2182(others.)S2580(If)S2704(the)S2894(\256rst)S3125(character)S3612(in)S3747(the)S3936(string)S4253(is)S4375(a)S4470(circum\257ex,)S2346 V1476(the)S1662(expression)S2217(matches)S2652(any)S2864(character)S3348(except)S3702(newline)S4125(and)S4338(the)S4525(characters)S2484 V1476(in)S1621(the)S1820(string.)S2207(For)S2425(example,)S2915(`)S2946(`[xyz]')S3274(')S3365(matches)S3812(`)S3843(`xx')S4035(')S4126(and)S4350(`)S4381(`zyx')S4627(',)S4748(while)S2622 V1476(`)S(`[\303xyz]')379 1507 A1876(')S1956(matches)S2392(`)S2423(`abc')S2663(')S2743(but)S2936(not)S3129(`)S3160(`axb')S3406('.)S3546(A)S3673(range)S3982(of)S4123(characters)S4656(may)S4904(be)S2760 V1476(speci\256ed)S1936(by)S2086(two)S2298(characters)S2821(separated)S3309(by)S3459(`)S(`-')123 3490 A3603('.)S3036 V12 B936(Actions)S3348 V12 R1116(Actions)S1537(are)S1730(expressed)S2251(as)S2396(a)S2494(subset)S2840(of)S2985(the)S3177(C)S(language.)466 3301 A3841(All)S4041(variables)S4523(are)S4716(global)S3486 V936(and)S1147(default)S1521(to)S1651(int's)S1903(if)S2014(not)S2204(formally)S
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -