git: How to automate interactive rebase / replace it by equivalent git commands

I found a possible solution:

git rebase --interactive sends the "list of rebase commits" (the list where you can pick, stash, edit, ...) to an editor. Which kind of editor can be configured. So the solution is to configure an alternative "editor" just for this interactive rebase. This can be done using the environment variable GIT_SEQUENCE_EDITOR:

GIT_SEQUENCE_EDITOR="command" git rebase -i SHA

command could be a shell script or just a simple sed:

GIT_SEQUENCE_EDITOR="sed -i 's/^pick ce5efdb /edit ce5efdb /;/^pick ce6efdb /d'" git rebase -i SHA

Important: The "list of rebase commits" is passed as file to the command. So the command must accept a filename as parameter and have to write the result to same file. "sed -i" is exactly doing this.