开发者

Redirect stdin stdout to multiple files

开发者 https://www.devze.com 2023-01-23 19:34 出处:网络
i am using tcsh shell, I am trying to write two files concurrent开发者_运维技巧ly with same output.

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

精彩评论

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