using awk to parse output

You can do something like this:

while read -r a b c d e; do
     echo "a=$a, b=$b, c=$c, d=$d, e=$e"
done < <(nc ... 2>&1 | awk -F '[[:blank:]]+wind0[[:blank:]]+' 'NF>1{print $2}')
a=220, b=0.0, c=0.0, d=8.2, e=0

Replace nc ... with your actual nc command line.


If you’re not using bash then use:

nc ... 2>&1 | awk -F '[[:blank:]]+wind0[[:blank:]]+' 'NF>1{print $2}' |
while read -r a b c d e; do
     echo "a=$a, b=$b, c=$c, d=$d, e=$e"
done

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top