This question already has an answer here:
There is a file named partner like:
abc def ghi
There is another conf file like:
part=abc var=x var=y id=123 part=def var=z id=345
and so on...
I am making a shellscript which reads line from 'partner' using while loop, then searches the block containing that partner name in conf file using sed. After that, and finally replacing id value (eg: from 123 to 123_1 )using sed and storing the new block in another file.
while read -r var || [[ -n "$var" ]] do sed -n '/part=$var/,/^$/p' conf.cfg | xargs sed 's/id=123/id=123_1/g' >> new.txt done
What am I doing wrong? As it only gives me empty lines of text as output.