Skip to content

Instantly share code, notes, and snippets.

@kkdd
Last active December 30, 2019 15:32
Show Gist options
  • Save kkdd/f849b0a4ae3a6ae5a4cd559da10d6916 to your computer and use it in GitHub Desktop.
Save kkdd/f849b0a4ae3a6ae5a4cd559da10d6916 to your computer and use it in GitHub Desktop.
sed 出力をカラー表示 ref: https://qiita.com/kkdd/items/c0247c35fce5c31fb27f
$ echo -e "11pp22\n33qq" | while read line; do esc=$(printf '\033'); echo $line | gsed -e "s,\([0-9]\+\)\([a-z]\+\)\([0-9]\+\)$,\1${esc}[32m\2${esc}[0m\3,"; done
11pp22
33qq
$ echo -e "111a222\n333" | GREP_COLOR='01;32' grep -E --color '^|\d+a'
111a222
333
$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment