Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
2
Task/General-FizzBuzz/AWK/general-fizzbuzz-1.awk
Normal file
2
Task/General-FizzBuzz/AWK/general-fizzbuzz-1.awk
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
awk -f fizzbuzzGenerate.awk input.txt > fizzbuzzCustom.awk
|
||||
awk -f fizzbuzzCustom.awk numbers.txt
|
||||
33
Task/General-FizzBuzz/AWK/general-fizzbuzz-2.awk
Normal file
33
Task/General-FizzBuzz/AWK/general-fizzbuzz-2.awk
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
# usage: awk -f fizzbuzzGen.awk > fizzbuzzCustom.awk
|
||||
#
|
||||
function Print(s) {
|
||||
print s > "/dev/stderr"
|
||||
}
|
||||
|
||||
BEGIN { Print( "# FizzBuzz-Generate:" )
|
||||
q2 = "\""
|
||||
fN = "numbers.txt"
|
||||
#fP = "fizzbuzzCustom.awk"
|
||||
}
|
||||
|
||||
NF==1 { Print( "# " $1 " Numbers:" )
|
||||
for( i=1; i <= $1; i++ )
|
||||
print( i ) > fN # (!!) write to file not allowed in sandbox at ideone.com
|
||||
|
||||
Print( "# Custom program:" )
|
||||
print "BEGIN {print " q2 "# CustomFizzBuzz:" q2 "} \n"
|
||||
next
|
||||
}
|
||||
|
||||
NF==2 { Print( "# " $1 "-->" $2 ) ##
|
||||
print "$1 % "$1" == 0 {x = x "q2 $2 q2 "}"
|
||||
next
|
||||
}
|
||||
|
||||
END { print ""
|
||||
print "!x {print $1; next}"
|
||||
print " {print " q2 " " q2 ", x; x=" q2 q2 "} \n"
|
||||
|
||||
print "END {print " q2 "# Done." q2 "}"
|
||||
Print( "# Done." )
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue