I have curious issue that I can't figure out...
Lets say we have variable:
_file="/var/log/messages"
and file containing also this block:
/var/log/secure /var/log/messages /var/log/cron /var/log/maillog {
compress
monthly
rotate 6
create 600
sharedscripts
postrotate
/bin/kill -HUP `cat /var/run/*syslog*.pid 2> /dev/null` 2> /dev/null || true
endscript
}
I need a sed command that would select this specific block which contain the $_file at the start and ending with } and than do something in it.... lets say remove the $_file from it..
First issue is that its path so we need to change delimiter in sed
sed -e "s|$_file[[:space:]]||" tests_file.txt
above will work, but I need to specify the block, normally it should look like:
sed -e "|$_file|,|\}|{s|$_file[[:space:]]||}"
but that always fail with:
sed: -e expression #1, char 1: unknown command: `|'
Any idea whats going on ?