Getting output with sed without writing to a file

HI
I am trying to grep 3 characters from hostname and append a character at the end.

I tried as in the following:

root@abag3:~# hostname | cut -c1-3
hyu

Now I am trying to append "g" at the end of this output as in the following.

root@abag3:~# hostname | cut -c1-3 | sed -s '/hyu/hyug'
hyu
yug

But I get output as "yug" but I require as "hyug"
Please help me to solve this.
Thanks in advance

hostname | sed -e 's/\(...\).*/\1/' -e 's/hyu/hyug/'

Hello Priya Amaresh,

Following may help you in same.

hostname | awk '{A=substr($0,1,3);sub(/hyu/,"hyug",A);print A}'
OR
hostname | awk '{A=substr($0,1,3);sub(/hyu/,"&g",A);print A}'

Thanks,
R. Singh

Thanks it worked :b:

$ hostname | sed -e 's/^\(hyu\).*/\1g/'