<?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: How to apply regex to a field in lookup file? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-apply-regex-to-a-field-in-lookup-file/m-p/340291#M100912</link>
    <description>&lt;P&gt;Assuming you just want to manipulate the result of the search &lt;CODE&gt;| inputlookup ABCD.csv&lt;/CODE&gt;, try like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup ABCD.csv | eval Host=mvindex(split(Host,"."),0)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;OR&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup ABCD.csv | rex field=Host "^(?&amp;lt;Host&amp;gt;[^\.]+)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 31 Oct 2017 20:55:53 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2017-10-31T20:55:53Z</dc:date>
    <item>
      <title>How to apply regex to a field in lookup file?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-apply-regex-to-a-field-in-lookup-file/m-p/340290#M100911</link>
      <description>&lt;P&gt;I have a lookup file query as follows &lt;/P&gt;

&lt;P&gt;| inputlookup ABCD.csv which displays the results as follows &lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Host&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;
efgh&lt;BR /&gt;
ijkl.mno.com&lt;BR /&gt;
pqrs.tuv.net&lt;BR /&gt;
wxyz&lt;/P&gt;

&lt;P&gt;Now how can i add a regex to display only the hostname and avoid the extra string which ever after the dot(.). I just want to apply the regex to display the result as follows &lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Host&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;
efgh&lt;BR /&gt;
ijkl&lt;BR /&gt;
pqrs&lt;BR /&gt;
wxyz&lt;/P&gt;</description>
      <pubDate>Tue, 31 Oct 2017 20:49:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-apply-regex-to-a-field-in-lookup-file/m-p/340290#M100911</guid>
      <dc:creator>pavanae</dc:creator>
      <dc:date>2017-10-31T20:49:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to apply regex to a field in lookup file?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-apply-regex-to-a-field-in-lookup-file/m-p/340291#M100912</link>
      <description>&lt;P&gt;Assuming you just want to manipulate the result of the search &lt;CODE&gt;| inputlookup ABCD.csv&lt;/CODE&gt;, try like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup ABCD.csv | eval Host=mvindex(split(Host,"."),0)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;OR&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup ABCD.csv | rex field=Host "^(?&amp;lt;Host&amp;gt;[^\.]+)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 31 Oct 2017 20:55:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-apply-regex-to-a-field-in-lookup-file/m-p/340291#M100912</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-10-31T20:55:53Z</dc:date>
    </item>
  </channel>
</rss>

