These are listed in page number order.
The input line Kathy 15.50 10 should be in italic. Thanks to Galen Menzel for spotting this error.
It should say "$2 is less than 20 ..." to match the code. Thanks to Kevin Lo for spotting this error.
The test at the top of the page should be
NR == 10 { exit }Otherwise the code prints 11 lines, not 10. Thanks to Mark Konezny.
The streaming version of mc one page 26 prints output in 7 columns, not 5, since the loop starts with n set to zero and ends with n = 6. Here's a better version:
{ out = sprintf("%s%-10.10s ", out, $0) if (++n >= 5) { print substr(out, 1, length(out)-2) out = "" n = 0 } }
The second version of mc on page 27 has a different problem: it doesn't include the two spaces between columns when computing the number of columns, so the result is always too high. Probably easiest fixed like this:
ncol = int(60 / (max+2) + 0.5) # int(x) returns integer value of xMany thanks to 郭济琳 (Jilin Guo) for spotting these errors.
The expression s = s $n++ " " in the function rest works on Awk but not on Gawk. It's an ambiguity in resolving the precedences of the prefix $ and the postfix ++. Fixed by adding parentheses:
s = s $(n++) " "The same construction appears near the middle of the page and is fixed in the same way. Thanks to 郭济琳 (Jilin Guo).
The split function is better written as
split(date, d)to properly handle single-digit days that might be preceded by two spaces instead of one. Alternatively, the third argument could be / +/. Thanks to 郭济琳 (Jilin Guo).
The test should be $5 < 0.5 to match the text, which says "What about beer with less that say 0.5%?" Thanks to 郭济琳 (Jilin Guo).
The derivation at the bottom of the page is missing a couple of intermediate states. It should read
Sentence -> Nounphrase Verbphrase -> the girl Verbphrase -> the girl Verb Modlist Adverb -> the girl runs Modlist Adverb -> the girl runs very Modlist Adverb -> the girl runs very very Modlist Adverb -> the girl runs very very Adverb -> the girl runs very very quicklyThanks to Eran Yarkon.
In
pfx = tolower($0) gsub(/[^A-Za-z]/, "", pfx)the RE doesn't need A-Z since pfx has no upper case letters. Thanks to Eran Yarkon.
The display should read title caption, not label.
On page 114, the line { ok = 1 } about 12 lines up from the bottom of the page doesn't do anything since ok is set to zero by the next pattern.
On page 115, inside the for loop in the END block, there's no need to test flag again; it's never empty at this point. Thanks to Eran Yarkon for these.
The sentence describing the countries file would be clearer if the descriptions were in the same order as the columns, as in "Each line contains the name of the name of a country, its area in thousands of square kilometers, its population in millions, and the continent it is in."
Thanks to Eric Bowles.
The line
close(x)in the include program should be
close($2)Thanks to Will Clardy.