I am doing a project for uni and an unsure how to proceed i have been given the task of changing hosts name from one thing to another on a unix box I am logged in to the box as root
the host name is garnet.bct.bolton.ac.uk garnet
I need to change .bct to .amt
The new host name should be garnet.amt.bolton.ac.uk garnet
I have multiple hostname in cat /etc/hosts and they all need changing from bct to amt
I think I need to use grep but that is as far as I have gotten
cat /etc/hosts | grep bct
sedwith no option will print the changed file to stdout (terminal normally). With the-ioption it changes the filein-place. It's in themanpage -man sed:-) – garethTheRed Dec 02 '14 at 13:28