import fileinput for line in fileinput input line line -1 s1 line find

1
2
3
4
5
6
7
8
import fileinput
for line in fileinput.input():
line = line[:-1]
s1 = line.find('[') + 1 # [17 of 44]
s2 = line.find(' of ')
sub = line[s1:s2]
print(f"mv {line} '{sub:0>2}_{line[1:]}")
print()