I have long a text file where each line looks something like /MM0001 (Table(12,)) or /MM0015 (Table(11,)). I want to keep only the four-digit number next to /MM. If it weren’t for the “table(12,)” part I could just strip all the non-numeric characters, but I don’t know how to extract the four-digit numbers only. Any advice on getting started?
I have long a text file where each line looks something like /MM0001 (Table(12,))
Share
If it’s exactly that format, you could just print out
line[3:7]