1*9a7741deSElliott Hughes{ print } 2*9a7741deSElliott Hughes{ print NR, NF, $0 } 3*9a7741deSElliott Hughes{ $2 = length($2); print } 4*9a7741deSElliott Hughes{ s += length($2) } 5*9a7741deSElliott HughesEND { print s } 6*9a7741deSElliott Hughes{ s += $3 } 7*9a7741deSElliott HughesEND { print s } 8*9a7741deSElliott Hughes{ for (i = NF; i > 0; i--) 9*9a7741deSElliott Hughes printf "%s ", $i 10*9a7741deSElliott Hughes printf("\n") 11*9a7741deSElliott Hughes} 12*9a7741deSElliott Hughes $1 == $1 && $2 == $2 # test some string compares 13*9a7741deSElliott Hughes $1 != $2 14*9a7741deSElliott Hughes{ 15*9a7741deSElliott Hughes sss = "" 16*9a7741deSElliott Hughes for (i = NF; i > 0; i--) 17*9a7741deSElliott Hughes sss = sss " " $i 18*9a7741deSElliott Hughes print sss 19*9a7741deSElliott Hughes} 20*9a7741deSElliott Hughes{ 21*9a7741deSElliott Hughes xx[$1] += length 22*9a7741deSElliott Hughes} 23*9a7741deSElliott HughesEND { 24*9a7741deSElliott Hughes for (i in xx) 25*9a7741deSElliott Hughes print i, xx[i] | "sort" 26*9a7741deSElliott Hughes} 27*9a7741deSElliott HughesNF % 2 == 0 28*9a7741deSElliott Hugheslength % 2 == 0 29*9a7741deSElliott Hughes! /^./ 30*9a7741deSElliott Hughes/.$/ 31*9a7741deSElliott HughesBEGIN { xxx = ".$" } 32*9a7741deSElliott Hughes$0 ~ xxx 33*9a7741deSElliott Hughes{ print substr($0, 10,10) } 34*9a7741deSElliott Hughes{ $3 = "xxx" $3 "xxx"; $4--; print } 35*9a7741deSElliott Hughes{ for (i = 1; i <= NF; i++) 36*9a7741deSElliott Hughes x[i] = $i 37*9a7741deSElliott Hughes for (i = 1; i <= NF; i++) 38*9a7741deSElliott Hughes print x[i] 39*9a7741deSElliott Hughes} 40*9a7741deSElliott Hughes{ for (i = 1; i <= NF; i++) 41*9a7741deSElliott Hughes y[i] = $i 42*9a7741deSElliott Hughes for (i = 1; i <= NF; i++) 43*9a7741deSElliott Hughes printf "%d %s\n", i, y[i] 44*9a7741deSElliott Hughes} 45*9a7741deSElliott Hughesfunction abs(x) { return (x < 0) ? -x : x } 46*9a7741deSElliott HughesBEGIN { n = 1000 47*9a7741deSElliott Hughes for (i = 1; i < n; i++) x[i] = rand() 48*9a7741deSElliott Hughes for (i in x) 49*9a7741deSElliott Hughes for (j in x) 50*9a7741deSElliott Hughes if (abs(x[i]-x[j]) < .01) break 51*9a7741deSElliott Hughes } 52