nkf
nkfとは
Network Kanji Filterの略.
おそらく日本では,最もメジャーな文字コード変換ツール.ほとんどのLinuxで標準インストールされている.
文字コードjis,shift_jis,euc-jp,utf-8.改行コードCRLF(Windows),LF(unix),CR(Mac)をサポート.
インストール
yumの場合,
# yum search nkf # yum install nkf.i386
でインストール完了,多分(確認してない).
ソースインストールの場合,
# cd /usr/local/src # wget http://keihanna.dl.sourceforge.jp/nkf/20770/nkf207.tar.gz # tar zxvf nkf207.tar.gz # cd nkf207 # make
でビルド(gcc 4.1.2, binutils 2.17で確認).実行ファイル/usr/local/src/nkf207/nkfができるだけなので,PATHが通っているディレクトリに実行ファイルをコピー.
# cp /usr/local/src/nkf207/nkf ~/bin/
使う
文字コードの確認.
% ls euc-jp.txt shift_jis.txt utf-8.txt % nkf --guess * euc-jp.txt:EUC-JP shift_jis.txt:Shift_JIS utf-8.txt:UTF-8 %
文字コードeuc-jpに.
% nkf -e FILES
文字コードutf-8に.
% nkf -w FILES
改行コードLFに.
% nkf -Lu -d FILES
このままでは標準出力に書き出すだけなので,変換を保存する場合はリダイレクト.
% nkf -e FILE1 >FILE2
もしくは--overwriteオプション.
% nkf -e --overwrite FILES
この場合は標準出力には出力されない.
cf
- % man nkf
- http://itpro.nikkeibp.co.jp/article/COLUMN/20060228/231148/
- http://www.yukun.info/blog/2008/01/euc-to-utf8.html
- http://oss.timedia.co.jp/show/MySQL日本語の旅/キャラクタコード変換ツール(nkf, iconv, kcc)
- http://cns-guide.sfc.keio.ac.jp/2004/2/4/12.html
less: behavior
lessコマンドの挙動を変える.
具体的には,
% echo aaa | less
として,qを入力したときに
% echo aaa | less %
となるか,
% echo aaa | less aaa %
となるかの違い.
manに書いてあるサンプルコマンドなどを参照しながらコマンドを実行することが多いので,後者に変える.
ターミナルエミュレータはurxvt(rxvt-unicode)を使っているので
% infocmp rxvt-256color >rxvt-256color.info
としてterminfoの情報をテキストファイルにリダイレクト.
値はカンマで区切ってある.
smcupはプログラム開始時に,rmcupはプログラム終了時の挙動.
smcup=\E[?47h rmcup=\E[?47h
とそれぞれ変更→保存.
これをterminfoデータベースに.
% tic rxvt-256color
これで~/.terminfo/r/rxvt-256colorが作成され,urxvt起動時に読み込まれるようになる.詳しくはman
% man 5 terminfo % man tic
fileencoding
エンコーディングをutf-8に指定し再読み込み.
:e ++enc=utf-8
euc-jpの場合も同様.
:e ++enc=euc-jp
エンコーディングをutf-8に変換する場合は.
:set fileencoding=utf-8
euc-jpの場合も同様.
:set fileencoding=euc-jp
保存すれば変換完了.
:w
blackbox: my style 081208
source
!!!!!Menu Style menu.frame.alignment: left menu.frame.appearance: raised gradient vertical menu.frame.color1: rgb:f/0/0 menu.frame.color2: rgb:9/0/0 menu.frame.borderWidth: 0 menu.frame.borderColor: rgb:f/0/0 menu.frame.foregroundColor: rgb:0/0/0 menu.frame.textColor: rgb:0/0/0 menu.frame.disabledColor: rgb:9/0/0 menu.frame.marginWidth: 0 menu.title.alignment: left menu.title.appearance: raised gradient vertical menu.title.color1: rgb:f/0/0 menu.title.color2: rgb:9/0/0 menu.title.borderWidth: 0 !menu.title.borderColor: rgb:0/0/0 menu.title.foregroundColor: rgb:0/0/0 menu.title.textColor: rgb:0/0/0 menu.title.marginWidth: 0 menu.active.appearance: raised gradient vertical menu.active.color1: rgb:9/0/0 menu.active.color2: rgb:f/0/0 menu.active.borderWidth: 0 !menu.active.borderColor: rgb:0/0/0 menu.active.foregroundColor: rgb:0/0/0 menu.active.textColor: rgb:0/0/0 !!!!!Slit Style slit.appearance: raised gradient vertical slit.color1: rgb:f/0/0 slit.color2: rgb:9/0/0 slit.borderWidth: 0 slit.borderColor: rgb:0/0/0 slit.marginWidth: 0 !!!!!Toolbar Style toolbar.alignment: center toolbar.appearance: flat solid toolbar.color: rgb:0/0/0 toolbar.borderWidth: 1 toolbar.borderColor: rgb:f/0/0 toolbar.marginWidth: 1 toolbar.label.appearance: flat solid toolbar.label.color: rgb:0/0/0 toolbar.label.borderWidth: 1 toolbar.label.borderColor: rgb:f/0/0 toolbar.label.marginWidth: 1 toolbar.label.textColor: rgb:f/0/0 toolbar.windowLabel.appearance: flat solid toolbar.windowLabel.color: rgb:0/0/0 toolbar.windowLabel.borderWidth: 1 toolbar.windowLabel.borderColor: rgb:f/0/0 toolbar.windowLabel.textColor: rgb:f/0/0 toolbar.clock.appearance: flat solid toolbar.clock.color: rgb:0/0/0 toolbar.clock.borderWidth: 0 toolbar.clock.borderColor: rgb:f/0/0 toolbar.clock.textColor: rgb:f/0/0 toolbar.button.appearance: flat solid toolbar.button.color: rgb:0/0/0/ toolbar.button.borderWidth: 0 toolbar.button.borderColor: rgb:f/0/0 toolbar.button.foregroundColor: rgb:f/0/0 toolbar.button.marginWidth: 1 toolbar.button.pressed.appearance: raised gradient vertical toolbar.button.pressed.color1: rgb:9/0/0 toolbar.button.pressed.color2: rgb:3/0/0 toolbar.button.pressed.borderWidth: 1 toolbar.button.pressed.borderColor: rgb:f/0/0 !!!!!Window Style window.alignment: right !!!title window.title.marginWidth: 0 window.title.focus.appearance: flat solid window.title.focus.color: rgb:f/0/0 window.title.focus.borderWidth: 0 window.title.focus.borderColor: rgb:f/0/0 window.title.unfocus.appearance: flat solid window.title.unfocus.color: rgb:f/f/f window.title.unfocus.borderWidth: 0 window.title.unfocus.borderColor: rgb:f/f/f !!!label window.label.marginWidth: 0 window.label.focus.appearance: flat solid window.label.focus.color: rgb:0/0/0 window.label.focus.borderWidth: 1 window.label.focus.borderColor: rgb:f/0/0 window.label.focus.textColor: rgb:f/0/0 window.label.unfocus.appearance: flat solid window.label.unfocus.color: rgb:0/0/0 window.label.unfocus.borderWidth: 0 window.label.unfocus.borderColor: rgb:c/0/0 window.label.unfocus.textColor: rgb:f/f/f !!!button window.button.marginWidth: 0 window.button.focus.appearance: flat solid window.button.focus.color: rgb:0/0/0 window.button.focus.borderWidth: 0 window.button.focus.borderColor: rgb:f/0/0 window.button.focus.foregroundColor: rgb:f/0/0 window.button.unfocus.appearance: flat solid window.button.unfocus.color1: rgb:0/0/0 window.button.unfocus.borderWidth: 0 window.button.unfocus.borderColor: rgb:f/0/0 window.button.unfocus.foregroundColor: rgb:f/f/f window.button.pressed.appearance: flat gradient vertical window.button.pressed.color1: rgb:9/0/0 window.button.pressed.color2: rgb:3/0/0 window.button.pressed.borderWidth: 0 !window.button.pressed.borderColor: rgb:f/0/0 !!!handle window.handleHeight: 1 window.handle.focus.appearance: flat solid window.handle.focus.color: rgb:0/0/0 window.handle.focus.borderWidth: 0 !window.handle.focus.borderColor: rgb:0/0/0 window.handle.unfocus.appearance: flat solid window.handle.unfocus.color: rgb:0/0/0 window.handle.unfocus.borderWidth: 0 !window.handle.unfocus.borderColor: rgb:0/0/0 !!!grip window.grip.focus.appearance: flat solid window.grip.focus.color: rgb:f/0/0 window.grip.focus.borderWidth: 0 window.grip.focus.borderColor: rgb:f/0/0 window.grip.unfocus.appearance: flat solid window.grip.unfocus.color: rgb:f/f/f window.grip.unfocus.borderWidth: 0 window.grip.unfocus.borderColor: rgb:0/0/0 !!!frame window.frame.borderWidth: 2 window.frame.focus.borderColor: rgb:0/0/0 window.frame.unfocus.borderColor: rgb:0/0/0 !!!command rootCommand: bsetroot -solid rgb:0/0/0
~/.blackbox/styles/style
bbkeys: my bbkeysrc 081208
source
# default bbkeys definitions....
[begin] (bbkeys configuration file)
[config]
[option] (stylefile) {~/.blackbox/styles/style}
[option] (honorModifiers) {false}
[option] (raiseWhileCycling) {false}
[option] (showCycleMenu) {true}
[option] (menuTextJustify) {center}
[option] (autoConfig) {true}
[option] (autoConfigCheckTimeout) {2}
[option] (workspaceColumns) {4}
# [option] (workspaceRows) {2}
# only one can be effective at a time
# if both are given, workspaceColumns takes precedence
[option] (cycleMenuX) {500}
[option] (cycleMenuY) {500}
[end]
[keybindings] (begin keybindings)
# [chain] (Control-Mod1-W)
# [sendToWorkspace] (1) {1}
# [sendToWorkspace] (2) {2}
# [sendToWorkspace] (3) {3}
# [sendToWorkspace] (4) {4}
# [sendToWorkspace] (5) {5}
# [sendToWorkspace] (6) {6}
# [sendToWorkspace] (7) {7}
# [sendToWorkspace] (8) {8}
# [end]
[Lower] (Mod1-Down)
[Raise] (Mod1-Up)
[toggleShade] (Mod1-F9)
[Close] (Mod1-F4)
# [Iconify] (Mod1-m)
[toggleMaximizeFull] (Mod1-F12)
[toggleMaximizeHorizontal] (Mod1-F11)
[toggleMaximizeVertical] (Mod1-F10)
[toggleOmnipresent] (Mod1-Control-S)
[resizeWindowWidth] (Mod1-Control-Shift-Left) {-5}
[resizeWindowWidth] (Mod1-Control-Shift-Right) {5}
[resizeWindowHeight] (Mod1-Control-Shift-Up) {-5}
[resizeWindowHeight] (Mod1-Control-Shift-Down) {5}
[moveWindowUp] (Mod1-Control-Up) {1}
[moveWindowDown] (Mod1-Control-Down) {1}
[moveWindowLeft] (Mod1-Control-Left) {1}
[moveWindowRight] (Mod1-Control-Right) {1}
[NextWindow] (Mod1-Tab)
# [NextWindowOnAllWorkspaces] (Mod1-Control-Tab)
# [PrevWindow] (Mod1-Shift-Tab)
[changeWorkspace] (Mod1-1) {1}
[changeWorkspace] (Mod1-2) {2}
[changeWorkspace] (Mod1-3) {3}
[changeWorkspace] (Mod1-4) {4}
[changeWorkspace] (Mod1-5) {5}
[changeWorkspace] (Mod1-6) {6}
[changeWorkspace] (Mod1-7) {7}
[changeWorkspace] (Mod1-8) {8}
# [upWorkspace] (Mod1-Control-K)
# [downWorkspace] (Mod1-Control-J)
# [leftWorkspace] (Mod1-Control-H)
# [rightWorkspace] (Mod1-Control-L)
[showRootMenu] (Mod1-Control-Escape)
#[Execute] (Mod1-F5) {xrefresh}
#[Execute] (Mod1-F1) {gnome-terminal}
#[Execute] (Mod4-E) {kfmclient openProfile filemanagement}
#[Execute] (F20) {kfmclient openProfile filemanagement}
#[Execute] (Mod4-E) {nautilus ~}
#[Execute] (F20) {nautilus ~}
[end] (end keybindings)
[end] (end bbkeys configuration)
~/.bbkeysrc