How can I replace sed -i command on AIX

I’m trying to find replacement for sed command with parameter -i how it’s used on Linux platform for AIX platform.
I need to convert this part of script used in Linux

sed -i 's/$host/'$hostname'/g' ./filename


1 Like

Welcome @Jezebull to nixCraft forum.

I think that is GNU/BSD sed option. Not supported on AIX. Try the following:

# save output to a file
sed "s/$host/'$hostname'/g" ./filename > output
# overwrite original file
mv output filename

Thank you very much! It works perfectly.
Brgds Jezebull

1 Like

Linux sysadmin blog - Linux/Unix Howtos and Tutorials - Linux bash shell scripting wiki