<?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 use rex and sed to remove field prefix? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-rex-and-sed-to-remove-field-prefix/m-p/349490#M103463</link>
    <description>&lt;P&gt;I would like to remove a prefix from a field where certain criteria are met but leave the prefix on on fields where criteria isnt met.&lt;/P&gt;

&lt;P&gt;e.g&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;uniqueIdentifier = admjdoe
| rex mode=sed field=uniqueIdentifier "s/^adm//g" 
output = jdoe

uniqueIdentifier = administrator
| rex mode=sed field=uniqueIdentifier "s/^adm//g" 
output = inistrator
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Obviously I don't want to remove the adm from administrator, and as the field includes names it should also correctly handle names like admaneil  (adm aniel) etc&lt;/P&gt;

&lt;P&gt;I need to have some kind of &lt;CODE&gt;if uniqueIdentifier = administrator&lt;/CODE&gt; then don't apply the sed command.&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
    <pubDate>Tue, 30 Jan 2018 13:09:23 GMT</pubDate>
    <dc:creator>dmcintosh1972</dc:creator>
    <dc:date>2018-01-30T13:09:23Z</dc:date>
    <item>
      <title>How to use rex and sed to remove field prefix?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-rex-and-sed-to-remove-field-prefix/m-p/349490#M103463</link>
      <description>&lt;P&gt;I would like to remove a prefix from a field where certain criteria are met but leave the prefix on on fields where criteria isnt met.&lt;/P&gt;

&lt;P&gt;e.g&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;uniqueIdentifier = admjdoe
| rex mode=sed field=uniqueIdentifier "s/^adm//g" 
output = jdoe

uniqueIdentifier = administrator
| rex mode=sed field=uniqueIdentifier "s/^adm//g" 
output = inistrator
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Obviously I don't want to remove the adm from administrator, and as the field includes names it should also correctly handle names like admaneil  (adm aniel) etc&lt;/P&gt;

&lt;P&gt;I need to have some kind of &lt;CODE&gt;if uniqueIdentifier = administrator&lt;/CODE&gt; then don't apply the sed command.&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jan 2018 13:09:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-rex-and-sed-to-remove-field-prefix/m-p/349490#M103463</guid>
      <dc:creator>dmcintosh1972</dc:creator>
      <dc:date>2018-01-30T13:09:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to use rex and sed to remove field prefix?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-rex-and-sed-to-remove-field-prefix/m-p/349491#M103464</link>
      <description>&lt;P&gt;Hi @dmcintosh1972&lt;/P&gt;

&lt;P&gt;Try something like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;yourBasesearch&amp;gt;
| rex mode=sed field=uniqueIdentifier "s/^adm(?!inistrator)//g"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 30 Jan 2018 14:15:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-rex-and-sed-to-remove-field-prefix/m-p/349491#M103464</guid>
      <dc:creator>harsmarvania57</dc:creator>
      <dc:date>2018-01-30T14:15:24Z</dc:date>
    </item>
  </channel>
</rss>

