I'd like to use awk
to parse an output containing color escape codes.
But awk fails to interpret colored number as numbers:
echo "[1,2,3]" | jq -C '.[]' | awk '{print $1," -> ",int($1)}'
1 -> 0
2 -> 0
3 -> 0
As you can see the color codes (inserted by jq -C
) prevent the string from parsing as an integer.
Is there a way to remove/ignore the escape color code from the input ?
Bonus point if the solution doesn't use regexes.