I want to write a script in sh that for each given file, for each printf occurrence, it will count the number of %'s (or alternatively the number of parameters the printf function receives) and rename the printf to printfX, when X is that number.
I got stuck because printf doesn't end with new line...
e.g.
printf("hello "
"world %d\n", 1);
should return
printf1("hello "
"world %d\n", 1);