gpt4 book ai didi

linux - 将文件的输出一行发送到远程 Linux 机器

转载 作者:太空宇宙 更新时间:2023-11-04 04:55:21 28 4
gpt4 key购买 nike

如何将此文件的输出发送到另一台 Linux 计算机的主目录。

显然,我想发送此文件的输出:

sed '/^\s*#/d;/^$/d' /etc/httpd/conf/httpd.conf

到 native 的主目录:

scp vagrant@192.168.33.10:httpd.conf

我想将这两个命令合并为一个命令。

我不确定是否可以在命令行中使用 - 来完成这项工作。

提前谢谢

最佳答案

通过 ssh 使用管道。
例如:

 sed '/^\s*#/d;/^$/d' /etc/httpd/conf/httpd.conf | ssh vagrant@192.168.33.10 'cat > httpd.conf'

关于linux - 将文件的输出一行发送到远程 Linux 机器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48070085/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com