0

How to escape double quotes inside another concatenated variable?

variable1=$(grep 'text' *.txt) -> value... <file="file.txt" stage="compile"
variable2=$(grep 'text' *.txt) -> value... size="10MB" process="zip">

variable3=$variable1' \"error\" '$variable2
variable3=<file="file.txt" stage="compile" "error" size="10MB" process="zip">

Desired output:
file="file.txt" stage="compile" "error" size="10MB" process="zip"

But I get this, without double quotes from variables 1 and 2:

file= stage= "error" size= process=

...then use value of variable3 in AWK command
    
AWK -i inplace NR=643 {sub(".*","${variable3}")};1' *.txt
Scripter
  • 19
  • 5
  • Please take a look at [How do I format my posts using Markdown or HTML?](https://stackoverflow.com/help/formatting). – Cyrus Mar 01 '22 at 20:46
  • I'm not sure I understand the values of `variable1` and `variable2`, and I'm sure I don't follow how you want to use the value of `variable3`. We would need details of the `awk` command you're trying to run to speak to how the output you want might be produced. – John Bollinger Mar 01 '22 at 21:02

0 Answers0