Quantcast
Channel: UNIX and Linux Forums
Viewing all articles
Browse latest Browse all 16232

Getting output with sed without wriitng to a file

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

I tried as in the following:
Code:

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

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

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

Viewing all articles
Browse latest Browse all 16232

Trending Articles