0

I would like to perform within a Python script the following: more 20151010_ABC.txt | grep QST > 20151010_ABC.txt.QST

for a number (almost a 1000 files) of such files.

Then,

to open within the script the VIM editor, passing on demand either *.txt or *.QST or NONE files as above.

Any ideas? Thank you!

Sample:

import subprocess
more = subprocess.Popen(['more', '20151010_AlterAeon.txt.prsd'], stdout=subprocess.PIPE,)
grep = subprocess.Popen(['grep', 'LVL'], stdin=more.stdout, stdout=subprocess.PIPE,)
feed = subprocess.Popen(['>', '20151010_AlterAeon.txt.prsd.LVL'], stdin=grep.stdout, stdout=subprocess.PIPE,)
end_of_pipe = feed.stdout
#print "Files:", end_of_pipe
for line in end_of_pipe:
    print line.strip()
Paradigm
  • 149
  • 1
  • 2
  • 10

1 Answers1

0

My question solved mainly based on the following:

result = subprocess.Popen('more 20151010_AlterAeon.txt.prsd | grep LVL >  
20151010_AlterAeon.txt.prsd.LVL',  
stdin=subprocess.PIPE, shell = True)
Paradigm
  • 149
  • 1
  • 2
  • 10