Edit HTTP response from command line

Hello everyone,

I have been experimenting with mimtproxy and mitmdump trying to replace or modify http response to 301 to redirect the request to another domain, I know this is possible using the a script but I was just wondering is it possible to do that from the command line?