开发者

Redirect stdin stdout to multiple files

i am using tcsh shell, I am trying to write two files concurrent开发者_运维技巧ly with same output. One file the stdout will send to the start of the file

and the second file stdout will send to the end of file. I have tried doing this

./something 2>&1 | tee log1.txt 1> log2.txt

Just log1.txt has the STDOUT data

Any ideas?

Thanks, Koby


You should simply call:

./something | tee file1.txt file2.txt file3.txt

EDIT: Ugly fix to append/prepend

./something | tee -a file1.txt | cat - file2.txt > tmp && mv tmp file2.txt

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜