Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有这个命令可以获取 2 个文件,执行一些格式化并输出结果。
curl https://www.cloudflare.com/ips-v{4,6} | sed 's/^/set_real_ip_from /;s/$/\;/' \ > /home/user/output.txt
它工作得很好,问题是如何在文件 1 和文件 2 之间添加换行符(保留对格式的更改)?
像这样 :
{ curl -s https://www.cloudflare.com/ips-v4 printf '\n\n' curl -s https://www.cloudflare.com/ips-v6 } | sed -r 's/^(.+)$/set_real_ip_from \1;/g' > /home/user/output.txt