ablog

不器用で落着きのない技術者のメモ

2009-08-24から1日間の記事一覧

HP-UX の vmstat の見方

とりあえず、浅いメモ。 # vmstat 1 procs memory page faults cpu r b w avm free re at pi po fr de sr in sy cs us sy id 2 1 0 962500 181391 1444 26 3 0 0 0 1 2953 45666 1270 14 2 83 ... r: 実行待ち行列にあるプロセス。 プロセスには実行可能状態…

正規表現でマッチした文字列の次の一行を取得する Perl ワンライナー

こんなファイルを作って、 % cat hoge.txt aaaline1bbb line2 cccc line1 aaa bbbb line2 cccc ワンライナーを実行してみる。 % perl -0777 -pe 's/.*line1.*\n(.*?)\n/$1/g' hoge.txt line2 cccc line2 cccc スクリプト化するとこんなコードになる。 % perl…

FQDN からドメイン名を取得する Perl ワンライナー

% echo w.w.w.google.co.jp|perl -pwe 's/.*\.([a-zA-Z0-9\-]+\.)(com|co\.jp|ne\.jp)/$1$2/' google.co.jp

zsh で「<>」を使って数値による範囲指定を行う

zsh

001.txt - 010.txt を作る。 % for i in {001..010} do touch $i.txt done % ls 001.txt 002.txt 003.txt 004.txt 005.txt 006.txt 007.txt 008.txt 009.txt 010.txt 005.txt - 010.txt のみ処理する。 % ls <5-10>.txt 005.txt 006.txt 007.txt 008.txt 009…

最終行だけ表示する Perl ワンライナー

最後の行だけ表示する。 perl -wnle 'eof and print' hoge.log 最初と最後の行だけ表示する。 perl -wnle 'print if($.==1 or eof)' hoge.log 複数ファイルの最初と最後の行だけ表示する。 perl -wnle 'print if($.==1 or eof);eof and close ARGV' *.log […