@peccul is peccu

(love peccu '(emacs lisp cat outdoor bicycle mac linux coffee))

小ネタ4.@hogehogeに色つける

データとか眺めてて素っ気ないときにどうぞ

% echo 'はてダ書いた "はてなブログに招待してもらった記念 - ぺっくブログミラー@peccul - http://d.hatena.ne.jp/peccu/20111110/hatenablog "'|
pipe% gawk '{print gensub(/(@\w+?\s)/,"\033[32m\\1\033[39m","g")}'

\033[ と m の間に数字書いたらそこから色とか点滅したりとか変えられます.\033[39mはデフォルトの色に戻す命令です.

「エスケープシーケンス 色」とか「bash 色」「プロンプト カラー」とかでどの番号がなに色とか出てきます.

碧色工房 - エスケープシーケンス - C言語
http://archive.linux.or.jp/JF/JFdocs/Bash-Prompt-HOWTO-5.html

Text attributes
0 All attributes off
1 Bold on
4 Underscore (on monochrome display adapter only)
5 Blink on
7 Reverse video on
8 Concealed on

Foreground colors
30 Black
31 Red
32 Green
33 Yellow
34 Blue
35 Magenta
36 Cyan
37 White

Background colors
40 Black
41 Red
42 Green
43 Yellow
44 Blue
45 Magenta
46 Cyan
47 White

ASCII Table - ANSI Escape sequences