Suppose we have two files, a.txt and b.txt . If we write anything in a.txt & b.txt, it should be redirected to c.txt.
假设我们有两个文件 ,a.txt和b.txt。 如果我们在a.txt和b.txt中写入任何内容,则应将其重定向到c.txt。
tee
may help for this purpose.
tee
可能会为此目的提供帮助。
You may try a command like this:
您可以尝试这样的命令 :
echo "hello" | tee -a a.txt >>b.txt
Both a.txt and b.txt will contain the “hello”.
a.txt和b.txt都将包含“ hello”。
No , but it should be redirected to c.txt
The data of both a.txt and b.txt should be redirected to third text file.
As i am giving input to a & b , it should be redirected to c.txt simultaneaously.
否,但应将其重定向到c.txt
a.txt和b.txt的数据都应重定向到第三个文本文件。
当我给a和b输入时,应同时将其重定向到c.txt。
The method above shows redirecting output a.txt -> b.txt
.
上面的方法显示了重定向输出a.txt -> b.txt
。
Are what you need “a -> c
and b -> c
” or “a -> b -> c
“.
您需要的是“ a -> c
和b -> c
”或“ a -> b -> c
”。
Both case can be derived from the above command with the similar idea.
两种情况都可以从上述命令以相似的想法派生出来。
翻译自: https://www.systutorials.com/how-to-redirect-anything-written-on-a-file-to-another-file-in-linux/