您好我正试图从shell脚本转移到python
awk -F' ' '{print FILENAME " "$2 " " $3 " " $5}' $text| tail -n+4|head -n -2
在python中创建子进程时,我收到一个错误。你能在我错的地方取悦吗?我尝试在F。
之后使用转义字符c1 = subprocess.Popen(["awk -F' ' '{print FILENAME " "$2 " " $3 " " $5}' {0} | tail -n+4|head -n -2".format(text)], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
output = c1.communicate()
print output
答案 0 :(得分:0)
我能够通过
来解决这个问题first =" awk -F' ' ' {print" +场地+" $ 2" +" $ 3" +" $ 5}' &#34 + + venue1" | tail -n + 4 | head -n -2"
c1 = subprocess.Popen([first],shell = True,stdout = subprocess.PIPE,stderr = subprocess.PIPE)
x = c1.communicate()[0]
输出是 XYZ 我需要x,y和z之间的空间