<?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: Splunk - retrieve nth word in a string in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Splunk-retrieve-nth-word-in-a-string/m-p/191671#M187212</link>
    <description>&lt;P&gt;Thanks MuS for a great suggestion.&lt;/P&gt;</description>
    <pubDate>Tue, 10 Jun 2014 05:57:11 GMT</pubDate>
    <dc:creator>rupesh30n</dc:creator>
    <dc:date>2014-06-10T05:57:11Z</dc:date>
    <item>
      <title>Splunk - retrieve nth word in a string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-retrieve-nth-word-in-a-string/m-p/191667#M187208</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;How can I retrieve nth word in a string using rex or other alternatives?&lt;/P&gt;

&lt;P&gt;For example:&lt;BR /&gt;
"ABC BBC XYZ QAS"&lt;BR /&gt;&lt;BR /&gt;
"POP IMP RIL WER"&lt;/P&gt;

&lt;P&gt;I want to extract XYZ and RIL here. Please note that they will always be the 3rd word but number of characters before them can vary.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Jun 2014 22:20:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-retrieve-nth-word-in-a-string/m-p/191667#M187208</guid>
      <dc:creator>rupesh30n</dc:creator>
      <dc:date>2014-06-06T22:20:07Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk - retrieve nth word in a string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-retrieve-nth-word-in-a-string/m-p/191668#M187209</link>
      <description>&lt;P&gt;Easy&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;yoursearchhere
| rex field=youroldfield "\S+\s+\S+\s+(?&amp;lt;yournewfield&amp;gt;\S+)\s"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 06 Jun 2014 22:38:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-retrieve-nth-word-in-a-string/m-p/191668#M187209</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2014-06-06T22:38:55Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk - retrieve nth word in a string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-retrieve-nth-word-in-a-string/m-p/191669#M187210</link>
      <description>&lt;P&gt;Thanks Iguinn. That worked and you saved my day!!.&lt;/P&gt;

&lt;P&gt;Is there a way we can generalize number of \S+\s+ instead of keep it adding to extract say 20th word?&lt;/P&gt;</description>
      <pubDate>Fri, 06 Jun 2014 23:08:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-retrieve-nth-word-in-a-string/m-p/191669#M187210</guid>
      <dc:creator>rupesh30n</dc:creator>
      <dc:date>2014-06-06T23:08:05Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk - retrieve nth word in a string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-retrieve-nth-word-in-a-string/m-p/191670#M187211</link>
      <description>&lt;P&gt;try &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=youroldfield "(\S+\s+){19}(?&amp;lt;yournewfield&amp;gt;\S+)\s"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;this will match 19 times a group of any character that is not a whitespace character followed by spaces, the next match will be your 20th field &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jun 2014 07:53:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-retrieve-nth-word-in-a-string/m-p/191670#M187211</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2014-06-09T07:53:24Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk - retrieve nth word in a string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-retrieve-nth-word-in-a-string/m-p/191671#M187212</link>
      <description>&lt;P&gt;Thanks MuS for a great suggestion.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jun 2014 05:57:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-retrieve-nth-word-in-a-string/m-p/191671#M187212</guid>
      <dc:creator>rupesh30n</dc:creator>
      <dc:date>2014-06-10T05:57:11Z</dc:date>
    </item>
  </channel>
</rss>

