Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I execute a sed command in my script:

sed -i "${1}s/${2}=.*/${2}=${REPLY}/" $3

this is the echo:

sed -i 13s/log4j.appender.ROOT2.File=.*/log4j.appender.ROOT2.File=/app/TET/log.log/ /applis/DIAPASON/diapason1/conf/log4j.properties

My error:

sed: -e expression n°1, character 61: unknown option fors`'

share|improve this question

1 Answer 1

up vote 3 down vote accepted

You have multiple '/' charachters inside the ${REPLY} variable, which is confusing sed. You can choose an alternate delimiter for the s/// command in most versions of sed, so if this were me, I'd try something like: sed -i "${1}s|${2}=.*|${2}=${REPLY}|" $3. This replaces the '/' for sed with '|', so that the '/' in ${REPLY} are (hopefully) not interpreted by sed.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.