For your trivial examples, syntax highlighting looks mildly good because they have short strings in them highlighted as such. But for most text I have seen, blanket-wrapping all awk or sed code (especially those that are even mildly complex) as a string is useless. It might as well not be highlighted at all.
Not only that, most of the actual text given as examples for processing have no meaningful application of bash syntax highlighting at all. In many cases, they just simply highlight random words and add noise to the text, making a visual parsing of it harder.
So, if highlighting was applied to the entire post because of a tag, at best they're mostly useless, at worst they're actively harming readability. I'd rather not have any syntax highlighting applied of these by default. If you need to highlight a command, highlight it using <!-- language: ... -->
.
By the way, awk
code can be syntax highlighted as awk, but not if it's wrapped in quotes:
<!-- language: lang-awk -->
BEGIN {
if ($0 ~ /foo/)
print "foo"
}

So, if anything, awk should be highlighted with that.
text-processing
? How can we know what tool an answer would use? And what highlighting would make sense forsed
? C can work forawk
but what would make sense forgrep
?grep '#' file
though. Orgrep foo | perl -pe ...
etc which breaks both of them. It's kinda tricky to get right.bash
is also tagged for those questions that have answers given withsed/grep/awk/etc
.. if adding code block had usage like triple backtick plus language name (like used in github) it would be easier to simply add/change language.. anyway just thought this would help