I have a variable which runs a specific bash command:
Model=`some bash commad`
The output of echo $Model
can be as below:
Model = Model RZ230
I want to grab only the value Model RZ230
I am using the following but it is not working:
Model=`some bash commad | awk '{print $2}'
Using above command I am getting output as:
RZ230
`My output should be
Model RZ230
Advertisement
Answer
Use Bash parameter expansion :
var="Model = Model RZ230" echo "${var##*= }" Model RZ230
Regards!