Reputation: 33
I have two variables that return:
echo $var1
def abc ghi
echo $var2
abc def abc abc abc
I want the output to return as ghi
Upvotes: 0
Views: 511
Reputation: 33
as per above comment, this worked for me
comm -3 <(echo "${var1// /$'\n'}" | sort -u) <(echo "${var2// /$'\n'}" | sort -u)
Upvotes: 3