When I use sudo to do some activities with files, these files change ownership. How can I use commands with sudo without changing owner of the files?
Example file archivos35.sh is from apache but I use sed (with usr admin sudo)
$ ls -l -rwxr-xrw-. 1 apache apache 181 Aug 5 11:56 archivos35.sh
admin with sudo ---
sudo sed -i s/old/new/g archivos35.sh
But doing that command with sudo changes the owner of the file
$ ls -l -rwxr-xrw-. 1 admin apache 181 Aug 5 11:56 archivos35.sh
How can I avoid using the command with sudo to change the owner of the file? I just want to make changes to the file without modifying its owner.