I'm trying to replace every multiline import inside a Python source file.. So, the source goes like
from XXX import ( AAA, BBB, ) from YYY import ( CCC, DDD, EEE, ... ) ...other instructions...
and I'd like to get something like
from XXX import AAA, BBB from YYY import CCC, DDD, EEE, ... ...other instructions...
I tried to use sed but it looks like it doesn't support non-greedy matching of the closing parenthesis, so it "eats" the second import.. :(
Any hint? Is this impossible with sed? Should I try with another tool?
Many thanks for your time!