LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Script Question (https://www.linuxquestions.org/questions/linux-newbie-8/script-question-174621/)

blubbfish 04-26-2004 03:38 AM

Script Question
 
i'm just on a script wich queries with snmpget aund i get the full string like this back:
"enterprises.231.2.10.2.2.5.4.10.1.6.4 = 1073741824"
now my question is how can i take only the number after the "=" sign ? i dont want to make a temporary text file and sed the unwanted things out it would be perfect if someone could tell me how i can pipe the string after the equals into a new Variable...

plz help

rkef 04-26-2004 04:08 AM

Into a variable? Ok. I'll show you, but I don't know what snmpget is so I just use the echo command as an example.

Code:

MYNUM=`echo "enterprises.231.2.10.2.2.5.4.10.1.6.4 = 1073741824" |awk '{ print $3 }'`
HTH.

blubbfish 04-26-2004 04:18 AM

perfect ! it works .... jiiihaaaa thanks


:D


All times are GMT -5. The time now is 05:37 PM.