I want to basically convert the bash shell script I have below into Python. Would anyone have an idea how I would be able to accomplish this please?
currentdir=`pwd`
find $currentdir -type f -exec grep -r 'host:' {} \; > GOODtest.txt
I almost have it in Python below: but I can't figure out how to get it to iterate over the list of files it found using glob. The code below only iterates over one file and stops
import glob
import re
for name in glob.glob('*ssh_time'):
strings=['host:']
output=[]
#print name
myvar = name
print myvar
with open(myvar, 'rb+') as f:
for line in f.readlines():
for subs in strings:
if subs in line:
output.append(line)
print(output)