I have a python script that searches through a file:
this is a sample of the input text file:
String A 1
String B 1
String B 2
String B 3
String A 2
String B 4
It stores a numerical value in string A, then does some processing for each existence of a segment of string B where each segment is a different number
y=0
while y < len(InFileStr):
if "String A" in InFileStr[y]:
StringA = int(InFileStr[y].split("")[2])
elif "String B" in InFileStr[y]):
print "String B" + int(InFileStr[y].split("")[2])"\n"
y+=1
This "should" produce:
String B 1
String B 2
String B 3
String B 4
where StringA =2 as it's overwritten
However, can't figure out how to just print
String B 1
String B 4
for line in InFileStr.y = 0. I think we'll need some more clarification of what this is meant to do before we can be much more helpful.