答案1
使用以下命令添加每行的 IP xargs
:
echo 'Server IP | File System | Total Size | Used Space | Available Space | Percentage'
for i in ...; do
ssh -q -i ~/production_private_key.pem $i "df -h --output=source,size,used,avail,pcent \
| tail -n+2 \
| grep -v tmp" \
| xargs -I{} printf '%s %s\n' "$i" {}
done
替换空白|
应该很容易