【发布时间】:2019-04-26 22:24:31
【问题描述】:
sed 命令未从文件中读取值。
with open('file.txt') as f:
content = f.read()
subprocess.call("sed -i '/name/s/$/%s /' copy_vmlist" % content ,shell=True)
上面一个不起作用。sed 命令应该在 copy_vmlist 中搜索“名称”,并将 file.txt 的内容(jega)附加到下一个 colmun。
Content of file.txt:
jega
Content of copy_vmlist:
Age
name
degree
Expected output in copy_vmlist:
Age
name jega
degree
【问题讨论】:
标签: python sed subprocess fabric