regex - Bash sed how to mask brackets -


i want search 'start') in file /etc/init.d/fhem, , write code read textfile file after statement above. @ moment message have close bracket 'start'). think have mask properly, far no luck trying that. may give me missing link?

cocconf=$(<coc.txt)#reading cod file insert in other file sed -r "\'start\')/a $cocconf" /etc/init.d/fhem #inserting said code 

you're missing / before regular expression. , there's no need escape single quotes inside double quotes. when use extended regexps, need escape parentheses. a command requires backslash after it, , text added must on next line.

sed -r "/start\)/a\ $cocconf" /etc/init.d/fhem 

Comments

Popular posts from this blog

java - Suppress Jboss version details from HTTP error response -

gridview - Yii2 DataPorivider $totalSum for a column -

Sass watch command compiles .scss files before full sftp upload -