General FizzBuzz: Difference between revisions

Content added Content deleted
m (→‎{{header|AWK}}: tweaks to output-format)
Line 51: Line 51:
* the custom program is run, and does the actual work to output the desired result
* the custom program is run, and does the actual work to output the desired result


;Input:
<lang bash>awk -f fizzbuzzGenerate.awk input.txt > fizzbuzzCustom.awk
awk -f fizzbuzzCustom.awk numbers.txt</lang>

;Input:
<pre>
<pre>
105
105
Line 61: Line 58:
7 Baxx
7 Baxx
</pre>
</pre>

<lang bash>awk -f fizzbuzzGenerate.awk input.txt > fizzbuzzCustom.awk
awk -f fizzbuzzCustom.awk numbers.txt</lang>


<!-- http://ideone.com/fACMfK -->
<!-- http://ideone.com/fACMfK -->
Line 87: Line 87:


END {
END {
print "x==" q2 q2 " {print $0; next}"
print "!x {print $1; next}"
print " {print " q2 "\\t" q2 " x; x=" q2 q2 "}"
print " {print " q2 " " q2 ", x; x=" q2 q2 "}"

print "END {print "q2"# Done."q2"}"
print "END {print "q2"# Done."q2"}"
print "# Done."
print "# Done."