title: Parsing version number of Linux distro to PHP variable
body: <p>I am trying to display the version number of a Linux distro on a web page. The distro is DietPi. The version number is stored in /DietPi/dietpi/.version and looks like this;</p>
  <pre><code>G_DIETPI_VERSION_CORE=7
  G_DIETPI_VERSION_SUB=3
  G_DIETPI_VERSION_RC=2
  G_GITBRANCH='master'
  G_GITOWNER='MichaIng'
  </code></pre>
  <p>This is what I have experimented with so far, which I've put together from examples I have found on SO.</p>
  <pre><code>&lt;?php system(&quot;cat /DietPi/dietpi/.version  | cut -f2 -d'=' | sed 's/[^0-9]*//g' &quot;) ;?&gt;
  </code></pre>
  <p>This works but there are spaces between the digits thus
  <code>7 3 2</code>
  and I need to add periods so it looks like this
  <code>7.3.2</code></p>
  <p>I suspect the above is probably not the most efficient way of doing this. I'd welcome help on inserting the periods or ideas on simpler methods that would work for me.</p>