So I am trying to extract an output similar to
x=($discover nginx --human=nood)
which gives me an output like
i-03099 nginx IP noodlefish pip b4b966d280546c6b070f5f952c281d3294308048
Further I want to extract the pip column in another variable. When I do
echo "$x" | cut -f6
I get my desired output, but when I try.
y= "$x" | cut -f6
I get a blank output.
Please can you explain me why is this happening and how can I get the result I want. Thank you in advance.
$discover
tab delimited? Why don't you pass it throughcut
immediately?x=("$discover" nginx --human=nood | cut -f 6)
orx=$("$discover" nginx --human=nood | awk '{ print $NF }')
– Kusalananda Nov 25 '19 at 16:29