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 have been struggling to replace every occurence of "<KEY>" in a file with ${encryptedkeyValue} I wrote this line but it is not doing anything. please help

awk ' { gsub("<KEY>","'${encryptedkeyValue}'") }1 ' ${scriptHome}/config.properties

Thanks in advance, Priya

share|improve this question
    
I see in your raw posting that you want to replace a KEY string. (I edited your posting, but you should confirm or correct it.) Please clarify whether the < and > and two " are part of the KEY keyword. I then adjust my answer accordingly. –  Janis Apr 21 at 21:13

1 Answer 1

If you mean to replace a string consisting of two double quotes, and also pass your variables using option -v, as in:

awk -v val="${encryptedkeyValue}" '{ gsub(/<KEY>/,val) } 1'
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.