i have a file that has a specific line of interest (say, line 12) that looks like this:
conform: 244216 (packets) exceed: 267093 (packets)
i've written a script to pull the first number via regex and dump the value into a new file:
getexceeds = open("file1.txt", "r").readlines()[12]
output = re.search(r"\d+", getexceeds).group(0)
with open("file2.txt", "w") as outp:
outp.write(output)
i am not quite good enough yet to return the second number in that line into a new file -- can anyone suggest a way?
thanks as always for any help!
re.findall(r"\d+", getexceeds)[1]
– Lillielilliputian