I have a shell script called demo.sh that runs a command and store the output in a variable.
Here is the script:
$#!/bin/sh
a=`asterisk -rx "core show hint 101"`
echo "${a}"
The output is:
101@hints : SIP/101 State:Unavailable Presence:not_set Watchers 0
I only need to get the State section, in this case Unavailable. This state is not fixed, it changes. I need to get whatever is after State: but before Presence:
How can I do this?