python - Piping commands in plink on windows command line -


i using python automate installation of rpms on linux box. m using plink connect linux box. first need info of installed rpms on box. command

os.system('plink root@server -pw pass rpm -qa|grep string > rpm.txt') 

here command line interpreters '|' cmd command , throws error "grep not recognized internal or external command, operable program or batch file"

also rpm.txt created on machine instead on linux box.

anyway can use '|' , makesure 'rmp.txt' created in linux box?

try this:

ff=subprocess.popen("plink root@server -pw pass rpm -qa",shell=false,stdin=subprocess.pipe)  ff.communicate("grep string > rpm.txt") 

a


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -