<?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 How to trim everything from a field after a comma in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-trim-everything-from-a-field-after-a-comma/m-p/464523#M146624</link>
    <description>&lt;P&gt;I have a field that contains: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;CN=Joe Smith,OU=Support,OU=Users,OU=CCA,OU=DTC,OU=ENT,DC=ent,DC=abc,DC=store,DC=corp
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I'd like to trim off everything after the first comma.&lt;BR /&gt;&lt;BR /&gt;
This information can always be changing, so there is no set number of characters.&lt;BR /&gt;&lt;BR /&gt;
Thanks.&lt;/P&gt;</description>
    <pubDate>Mon, 10 Feb 2020 16:07:59 GMT</pubDate>
    <dc:creator>sawyer2624</dc:creator>
    <dc:date>2020-02-10T16:07:59Z</dc:date>
    <item>
      <title>How to trim everything from a field after a comma</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-trim-everything-from-a-field-after-a-comma/m-p/464523#M146624</link>
      <description>&lt;P&gt;I have a field that contains: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;CN=Joe Smith,OU=Support,OU=Users,OU=CCA,OU=DTC,OU=ENT,DC=ent,DC=abc,DC=store,DC=corp
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I'd like to trim off everything after the first comma.&lt;BR /&gt;&lt;BR /&gt;
This information can always be changing, so there is no set number of characters.&lt;BR /&gt;&lt;BR /&gt;
Thanks.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Feb 2020 16:07:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-trim-everything-from-a-field-after-a-comma/m-p/464523#M146624</guid>
      <dc:creator>sawyer2624</dc:creator>
      <dc:date>2020-02-10T16:07:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to trim everything from a field after a comma</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-trim-everything-from-a-field-after-a-comma/m-p/464524#M146625</link>
      <description>&lt;P&gt;Hi @sawyer2624&lt;BR /&gt;
try&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|rex field=yourfield "CN\=(?P&amp;lt;commonName&amp;gt;[^\,]+)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 10 Feb 2020 16:45:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-trim-everything-from-a-field-after-a-comma/m-p/464524#M146625</guid>
      <dc:creator>nickhills</dc:creator>
      <dc:date>2020-02-10T16:45:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to trim everything from a field after a comma</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-trim-everything-from-a-field-after-a-comma/m-p/464525#M146626</link>
      <description>&lt;P&gt;Using sed mode on &lt;CODE&gt;rex&lt;/CODE&gt; is one way to do it:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval thefield="CN=Joe Smith,OU=Support,OU=Users,OU=CCA,OU=DTC,OU=ENT,DC=ent,DC=abc,DC=store,DC=corp"
| rex field=thefield mode=sed "s/([^,]+).*/\1/g"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This Run Anywhere example shows a replace in-situ, which has the side effect of forever altering "thefield" going forward.&lt;/P&gt;

&lt;P&gt;See &lt;A href="https://regex101.com/r/EHmicm/1"&gt;https://regex101.com/r/EHmicm/1&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Feb 2020 16:58:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-trim-everything-from-a-field-after-a-comma/m-p/464525#M146626</guid>
      <dc:creator>jpolvino</dc:creator>
      <dc:date>2020-02-10T16:58:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to trim everything from a field after a comma</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-trim-everything-from-a-field-after-a-comma/m-p/464526#M146627</link>
      <description>&lt;P&gt;So that creates a new field just like I want it, but how do I get the original field out of the table?&lt;/P&gt;</description>
      <pubDate>Mon, 10 Feb 2020 17:01:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-trim-everything-from-a-field-after-a-comma/m-p/464526#M146627</guid>
      <dc:creator>sawyer2624</dc:creator>
      <dc:date>2020-02-10T17:01:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to trim everything from a field after a comma</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-trim-everything-from-a-field-after-a-comma/m-p/464527#M146628</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;|rex field=yourfield "CN\=(?P&amp;lt;commonName&amp;gt;[^\,]+)"|fields - yourfield
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 10 Feb 2020 17:02:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-trim-everything-from-a-field-after-a-comma/m-p/464527#M146628</guid>
      <dc:creator>nickhills</dc:creator>
      <dc:date>2020-02-10T17:02:58Z</dc:date>
    </item>
  </channel>
</rss>

