write ahead log

ロールフォワード用

catの-(ハイフン)オプションを使う

こんなファイルを用意する.

$ cat > test.txt <<EOS
test
test
test
test
EOS
$ cat > test2.txt <<EOS
test2
test2
test2
test2
EOS

これを普通にパイプでつなぐとパイプで入ってきた入力は無視される.

$ cat test.txt | cat test2.txt
test2
test2
test2
test2

-(ハイフン)を使うとファイルの入力のように扱うことができる.

標準入力を第一引数に指定する感じ.

$ cat test2.txt | cat - test.txt
test2
test2
test2
test2
test
test
test
test

標準入力を第二引数に指定する感じ.

$ cat test2.txt | cat test.txt -
test
test
test
test
test2
test2
test2
test2

ワンライナーとかで便利かも.