0%

How to Use AWK in Bash Scripting

How to Use AWK in Bash Scripting

Commandline:

1
lxc-info -n containerName -s | awk '{print $2}'

Bash scripting:

1
2
3
4
rt="$(lxc-info -n containerName -s | awk '{print $2}')"
if [ $rt = "RUNNING" ]; then
. . .
fi

Reference:
http://www.cyberciti.biz/faq/bash-scripting-using-awk/