I am working on an application which requires some configuration to be stored in /etc/hosts file of a docker container. I have tried it with many options but did not find a
I had the same problem and overcome it with vi in ex mode.
vi
ex
ex -sc '%s/foo/bar/g|x' /etc/hosts