This is a card in Dave's Virtual Box of Cards.
Better AWK?
Page created: 2023-06-07Back to mushrat or over to better-sed
I love AWK except:
-
Different implementations have different features. This prevents me from using it. Period.
-
The built-in line parsing action stops at one level, then you’re doing stupid stuff with for loops over character streams. Why?!
I want AWK’s implicit line parsing to have multiple levels (the first three of which would have default/implicit behavior):
[match] { per line } <--- what awk does now
[match] { per line
[match] { per word }
}
[match] { per line
[match] { per word
[match] { per char }
}
}
Just thinking out loud here: I might add string interpolation and implicit variables $l, $w, $c for this behavior.
Then, if I want to print every word inside some square brackets:
{{ print "[$w]" }}
Not sure how that would actually work in practice, but I like it at first blush.