I got weird comments on posting an awk answer on SO which uses the getline function. Here is the link to that answer.
After posting my answer, a user came up with the below comment,(I don't criticize him.)
Not a good solution, it will join lines regardless of content and not process more lines if needed. And you should avoid using getline.
It states that we should avoid the getline function in awk. So my questions are,
- Is it safe to use
getlinefunction in awk? - In what circumstances should we use
getlinein what cases shouldn't we? - If this function produces unexpected results then why don't we file a bug report?
getlinefunction per se. It can be a code smell though as it is easily misused, either (a) in un-idiomatic constructions when awk already supports line-by-line pattern-action operation, or (b) in attempting tasks too complicated for awk. I would liken it to the much debatedgotostatement in C in these respects: potentially useful, easily abused.