繁体   English   中英

如何编写一个 shell 脚本将多行数据一次附加到 3 个不同的文件并搜索该数据是否已经存在并忽略它?

[英]How to write a shell script to append multiple line of data to 3-different file at a time and search if that data already exists and ignore it?

尝试使用: sed -i $ a 'hello' << foo.txt

当我尝试使用多个文件时,我无人看管。 有人请帮忙解决这个问题。 感谢您的回复! 谢谢

查看tee命令。 就像是

echo "new line" | tee -a file1 file2 file3

为了防止它也发送到标准输出,您可以随后重定向到/dev/null

echo "new line" | tee -a file1 file2 file3 > /dev/null

您可以在其联机帮助页man tee阅读更多内容。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM