title: Fetch Information Out Of SNMP Output At Linux Bash
body: <p>I'm writing down a bash script which connects to my GPS router using SNMP command.
  I'm using "snmpwalk", this is the command :</p>
  
  <pre><code>snmpwalk -v 2c 10.0.0.250 -c public enterprises.30140.7.2
  </code></pre>
  
  <p>It returns back :</p>
  
  <pre><code>SNMPv2-SMI::enterprises.30140.7.2.0 = STRING: "3203.558467N"
  </code></pre>
  
  <p>Now my main target is to get the number "3203.558467" without the "N".</p>
  
  <p>I'm new to Linux/bash and after a couple of searches I found that there is such thing called "eval", it helped me out and separated the whole string into an array and putted "3203.558467N" at the 4th cell (The code is at the end). </p>
  
  <p>It's still not what I wanted since "N" is there.
  I know that there are few more ways such as "sed" and "tr" but I don't know quite how to use them efficiently.<br>
  What is the best way to separate "3203.558467" in order to use this number for calculation?</p>
  
  <pre><code>#!/bin/bash
  
  latitude=$(snmpwalk -v 2c 10.0.0.250 -c public enterprises.30140.7.2)
  eval x=($latitude)
  echo "latitude is : ${x[3]}"
  </code></pre>