tags:

views:

25

answers:

3

hi all

how to join string from the left side to the output

For example (we want to join parameter="file/"

remark: file=/dir1/dir2/ (file have value)

    echo  aaa bbb |  awk '{print $2}' | sed ....

Will print

    /dir1/dir2/bbb
A: 

Assuming your input is good, this should be enough.

sed "s|\(.*\)|$VARIABLE\1|"
Anders
echo aaa bbb | awk '{print $2}' | sed "s/\(.*\)/$file\/\1/" not work -(
lidia
file is parameter for example file=/etc/sysconfig
lidia
@lidia, updated.
Anders
A: 
echo aaa bbb | awk '{print "file/"$2}'
Scharron
I have case that file is parameter with valuehow to change your syntax in order to enable file=/etc/sysconfig
lidia
`echo aaa bbb | awk '{print "'$your_var'"$2}'`
Scharron
A: 

How about:

echo aaa bbb | awk '{ print "file/" $2 }'
Brandon Horsley
but if file=/etc/sysconfig what then?
lidia
lidia, you are correct, you changed the question after I replied and my solution no longer applies.
Brandon Horsley