shell - SED command is not working -


i facing problem in below command

input_file_name_path="/app/csa/sumit/xyz.out"  sed -i "s/^$inputfile=.*/$inputfile='${input_file_name_path}'/g" dashboard.prf  error : sed: -e expression #1, char 36: unknown option `s' 

when using value of input_file_name_path without using "/" working fine..but when use "/" in value of variable input_file_name_path giving error. know problem "/" character. can 1 me resolve problem.

any appreciated.

you can use @ character instead of / separator, code like:

input_file_name_path="/app/csa/sumit/xyz.out"  sed -i 's@^$inputfile=.*@$inputfile='${input_file_name_path}'@g' dashboard.prf 

you can use sed -n , add trailing p test regular expressions without modifying file in question , displaying if matches, example:

sed -n 's@^$inputfile=.*@$inputfile='${input_file_name_path}'@gp' dashboard.prf 

and print if matches. not idea combine -n , -i, end small file :(


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -