[root@server ~]# a="test1" [root@server ~]# b="2test" [root@server ~]# echo $a | sed "s 1 $b " test2test [root@server ~]#