<?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 extract only first word from a field value in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-only-first-word-from-a-field-value/m-p/600361#M208987</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;I am not getting any results with this. Looks like it is replacing complete field value with Null/empty value&lt;/P&gt;</description>
    <pubDate>Thu, 02 Jun 2022 22:15:58 GMT</pubDate>
    <dc:creator>sashib</dc:creator>
    <dc:date>2022-06-02T22:15:58Z</dc:date>
    <item>
      <title>How to extract only first word from a field value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-only-first-word-from-a-field-value/m-p/600352#M208983</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;I need to extract only name values (first word value eg:james) from the below Name filed&lt;/P&gt;
&lt;P&gt;I tried with&amp;nbsp;&amp;nbsp;rex field=Name mode=sed "s/\W+\s\w.*//g" but not working&lt;/P&gt;
&lt;P&gt;Name&lt;/P&gt;
&lt;P&gt;james buildingA&lt;/P&gt;
&lt;P&gt;jack buildingB firstfloor&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you please help me with this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jun 2022 22:03:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-only-first-word-from-a-field-value/m-p/600352#M208983</guid>
      <dc:creator>sashib</dc:creator>
      <dc:date>2022-06-02T22:03:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract only first word from a field value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-only-first-word-from-a-field-value/m-p/600360#M208986</link>
      <description>&lt;LI-CODE lang="markup"&gt;| rex field=Name mode=sed "s/\W.*//g"&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 02 Jun 2022 22:00:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-only-first-word-from-a-field-value/m-p/600360#M208986</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-06-02T22:00:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract only first word from a field value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-only-first-word-from-a-field-value/m-p/600361#M208987</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;I am not getting any results with this. Looks like it is replacing complete field value with Null/empty value&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jun 2022 22:15:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-only-first-word-from-a-field-value/m-p/600361#M208987</guid>
      <dc:creator>sashib</dc:creator>
      <dc:date>2022-06-02T22:15:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract only first word from a field value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-only-first-word-from-a-field-value/m-p/600382#M208996</link>
      <description>&lt;P&gt;It works with the example you provided - perhaps this wasn't an accurate enough representation of your events. The rex assumes that the very first character of the field is a letter or number as it replaces from the first non-letter/number (\W) onwards. Try it this way (which replaces from the first "space" onwards)&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex field=Name mode=sed "s/\s.*//g"&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 03 Jun 2022 05:20:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-only-first-word-from-a-field-value/m-p/600382#M208996</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-06-03T05:20:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract only first word from a field value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-only-first-word-from-a-field-value/m-p/600402#M209009</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/236329"&gt;@sashib&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;let me understand: you want to extract the first word of a field (called e.g. "your_field") and put it into a field called Name, is it correct?&lt;/P&gt;&lt;P&gt;If this is you need, please try this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex field=your_field "^(?&amp;lt;name&amp;gt;\w*)"&lt;/LI-CODE&gt;&lt;P&gt;you can test the regex at&amp;nbsp;&lt;A href="https://regex101.com/r/9YZSF6/1" target="_blank"&gt;https://regex101.com/r/9YZSF6/1&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jun 2022 07:46:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-only-first-word-from-a-field-value/m-p/600402#M209009</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2022-06-03T07:46:16Z</dc:date>
    </item>
  </channel>
</rss>

