Ashok Ashok - 1 year ago 48
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 1.text and 2.text I have below contents



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 Source

and read a shell tutorial.