Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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


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.