Ashok Ashok - 7 months ago 13
Bash Question

storing the output of awk command into a variable

I want to store the output of command into var1 and var2 I tried with the below code.in 1.text and 2.text I have below contents

1.text
<assertive
<acidify
<something
<code-bat

2.text
<assertive
<acidify
>fish
>Fruehauf

var1 = `awk 'FNR==NR{a[$0];next}!($0 in a)' 1.text 2.text`
var2 = `awk 'FNR==NR{a[$0];next}!($0 in a)' 2.text 1.text`
echo $var1;
echo "================================================";
echo $var2;

Answer
var=$(command)

and read a shell tutorial.

Comments