<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: RegEx for the free -m command - Linux in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/RegEx-for-the-free-m-command-Linux/m-p/176200#M50596</link>
    <description>&lt;P&gt;Perfect!! Thank you!&lt;/P&gt;</description>
    <pubDate>Fri, 08 Aug 2014 18:09:05 GMT</pubDate>
    <dc:creator>aferone</dc:creator>
    <dc:date>2014-08-08T18:09:05Z</dc:date>
    <item>
      <title>RegEx for the free -m command - Linux</title>
      <link>https://community.splunk.com/t5/Splunk-Search/RegEx-for-the-free-m-command-Linux/m-p/176198#M50594</link>
      <description>&lt;P&gt;I have a script that runs the "free -m" command, and I am only pulling (grepping) the lines like the following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;-/+ buffers/cache:        219       1789
-/+ buffers/cache:       1469      10557
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The first value is used memory, and the second value is free memory.  &lt;/P&gt;

&lt;P&gt;The RegEx for free memory works for all of the logs:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(?i)^[^:]*:\s+\d+\s+(?P&amp;lt;FreeMemory&amp;gt;.+)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;However, for used memory, the following RegEx only works for the 2nd log line above, because of the amount of spaces between "cache:" and the value.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(?i)/cache:       (?P&amp;lt;UsedMemory&amp;gt;[^ ]+)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;How do I get the RegEx to work, regardless of how many spaces are in between?&lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 08 Aug 2014 14:07:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/RegEx-for-the-free-m-command-Linux/m-p/176198#M50594</guid>
      <dc:creator>aferone</dc:creator>
      <dc:date>2014-08-08T14:07:10Z</dc:date>
    </item>
    <item>
      <title>Re: RegEx for the free -m command - Linux</title>
      <link>https://community.splunk.com/t5/Splunk-Search/RegEx-for-the-free-m-command-Linux/m-p/176199#M50595</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;

&lt;P&gt;Use this regex to extract both values at the same time:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex "\:\s+(?&amp;lt;usedmemory&amp;gt;\d+)\s+(?&amp;lt;freememory&amp;gt;\d+)" | ...
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Fri, 08 Aug 2014 14:45:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/RegEx-for-the-free-m-command-Linux/m-p/176199#M50595</guid>
      <dc:creator>gfuente</dc:creator>
      <dc:date>2014-08-08T14:45:40Z</dc:date>
    </item>
    <item>
      <title>Re: RegEx for the free -m command - Linux</title>
      <link>https://community.splunk.com/t5/Splunk-Search/RegEx-for-the-free-m-command-Linux/m-p/176200#M50596</link>
      <description>&lt;P&gt;Perfect!! Thank you!&lt;/P&gt;</description>
      <pubDate>Fri, 08 Aug 2014 18:09:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/RegEx-for-the-free-m-command-Linux/m-p/176200#M50596</guid>
      <dc:creator>aferone</dc:creator>
      <dc:date>2014-08-08T18:09:05Z</dc:date>
    </item>
  </channel>
</rss>

