sed命令将换行转换为逗号 ips_comma=$(sed ':t;N;s/ /,/;b t' file) 参考:https://zhidao.baidu.com/question/468603364.html