<?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 can I skip the first two &amp;quot;\n&amp;quot; letters from my fields? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-skip-the-first-two-quot-n-quot-letters-from-my-fields/m-p/368884#M108718</link>
    <description>&lt;P&gt;Try like this (run anywhere sample search, just add the last eval line to your existing search)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| gentimes start=-1 | eval jobname="\nCDIARIA2 \nCDIARIAC \nMAROV91 \nMAFTB87 \nMATBU90" | makemv jobname | mvexpand jobname | stats count by jobname 
| eval jobname=replace(jobname,"\\\n","")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 13 Nov 2017 19:12:02 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2017-11-13T19:12:02Z</dc:date>
    <item>
      <title>How can I skip the first two "\n" letters from my fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-skip-the-first-two-quot-n-quot-letters-from-my-fields/m-p/368880#M108714</link>
      <description>&lt;P&gt;Hello Everyone!&lt;/P&gt;

&lt;P&gt;I want to remove the first two letters from my fields "\n" how can I do it?&lt;/P&gt;

&lt;P&gt;\nCDIARIA2&lt;BR /&gt;
\nCDIARIAC&lt;BR /&gt;
\nMAROV91&lt;BR /&gt;
\nMAFTB87&lt;BR /&gt;
\nMATBU90&lt;/P&gt;

&lt;P&gt;I only want this:&lt;/P&gt;

&lt;P&gt;CDIARIA2&lt;BR /&gt;
CDIARIAC&lt;BR /&gt;
MAROV91&lt;BR /&gt;
MAFTB87&lt;BR /&gt;
MATBU90&lt;/P&gt;

&lt;P&gt;Regards!&lt;/P&gt;</description>
      <pubDate>Mon, 13 Nov 2017 18:42:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-skip-the-first-two-quot-n-quot-letters-from-my-fields/m-p/368880#M108714</guid>
      <dc:creator>danielgp89</dc:creator>
      <dc:date>2017-11-13T18:42:15Z</dc:date>
    </item>
    <item>
      <title>Re: How can I skip the first two "\n" letters from my fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-skip-the-first-two-quot-n-quot-letters-from-my-fields/m-p/368881#M108715</link>
      <description>&lt;P&gt;Can you provide more details around how you get these fields, please?&lt;/P&gt;</description>
      <pubDate>Mon, 13 Nov 2017 18:46:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-skip-the-first-two-quot-n-quot-letters-from-my-fields/m-p/368881#M108715</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2017-11-13T18:46:32Z</dc:date>
    </item>
    <item>
      <title>Re: How can I skip the first two "\n" letters from my fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-skip-the-first-two-quot-n-quot-letters-from-my-fields/m-p/368882#M108716</link>
      <description>&lt;P&gt;Hello MuS! Thanks for your answer. &lt;/P&gt;

&lt;P&gt;This is the query I'm using &lt;/P&gt;

&lt;P&gt;index=mf JCL ERROR* |stats count by jobname&lt;/P&gt;

&lt;P&gt;An it brings me this but I don't want the \n&lt;/P&gt;

&lt;H2&gt;jobname                     count&lt;/H2&gt;

&lt;P&gt;\nCDIARIA2&lt;BR /&gt;
\nCDIARIAC&lt;BR /&gt;
\nMAROV91&lt;BR /&gt;
\nMAFTB87&lt;BR /&gt;
\nMATBU90&lt;/P&gt;</description>
      <pubDate>Mon, 13 Nov 2017 19:06:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-skip-the-first-two-quot-n-quot-letters-from-my-fields/m-p/368882#M108716</guid>
      <dc:creator>danielgp89</dc:creator>
      <dc:date>2017-11-13T19:06:43Z</dc:date>
    </item>
    <item>
      <title>Re: How can I skip the first two "\n" letters from my fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-skip-the-first-two-quot-n-quot-letters-from-my-fields/m-p/368883#M108717</link>
      <description>&lt;P&gt;You can use a regex to exclude the first  2 characters. If all of them have \n you could simple use \n(?.+?) with the |rex command.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Nov 2017 19:11:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-skip-the-first-two-quot-n-quot-letters-from-my-fields/m-p/368883#M108717</guid>
      <dc:creator>oawelewa</dc:creator>
      <dc:date>2017-11-13T19:11:05Z</dc:date>
    </item>
    <item>
      <title>Re: How can I skip the first two "\n" letters from my fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-skip-the-first-two-quot-n-quot-letters-from-my-fields/m-p/368884#M108718</link>
      <description>&lt;P&gt;Try like this (run anywhere sample search, just add the last eval line to your existing search)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| gentimes start=-1 | eval jobname="\nCDIARIA2 \nCDIARIAC \nMAROV91 \nMAFTB87 \nMATBU90" | makemv jobname | mvexpand jobname | stats count by jobname 
| eval jobname=replace(jobname,"\\\n","")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 13 Nov 2017 19:12:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-skip-the-first-two-quot-n-quot-letters-from-my-fields/m-p/368884#M108718</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-11-13T19:12:02Z</dc:date>
    </item>
    <item>
      <title>Re: How can I skip the first two "\n" letters from my fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-skip-the-first-two-quot-n-quot-letters-from-my-fields/m-p/368885#M108719</link>
      <description>&lt;P&gt;My answer would be same as somesoni&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    eval jobname=replace(jobname,"\\\n","")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 13 Nov 2017 19:13:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-skip-the-first-two-quot-n-quot-letters-from-my-fields/m-p/368885#M108719</guid>
      <dc:creator>akocak</dc:creator>
      <dc:date>2017-11-13T19:13:22Z</dc:date>
    </item>
    <item>
      <title>Re: How can I skip the first two "\n" letters from my fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-skip-the-first-two-quot-n-quot-letters-from-my-fields/m-p/368886#M108720</link>
      <description>&lt;P&gt;Okay too slow in the morning hours &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;here is my answer anyway:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval foo="\nCDIARIA2 \nCDIARIAC \nMAROV91 \nMAFTB87 \nMATBU90" 
| makemv foo 
| mvexpand foo
| eval jobname=ltrim(foo,"\n") 
| stats count by jobname
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The first 4 lines are just to produce dummy data, the &lt;CODE&gt;ltrim()&lt;/CODE&gt; is the one you can use to remove unwanted characters from the left.&lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
      <pubDate>Mon, 13 Nov 2017 19:19:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-skip-the-first-two-quot-n-quot-letters-from-my-fields/m-p/368886#M108720</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2017-11-13T19:19:12Z</dc:date>
    </item>
    <item>
      <title>Re: How can I skip the first two "\n" letters from my fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-skip-the-first-two-quot-n-quot-letters-from-my-fields/m-p/368887#M108721</link>
      <description>&lt;P&gt;Thanks so much!&lt;/P&gt;

&lt;P&gt;It works!&lt;/P&gt;

&lt;P&gt;Best Regards!&lt;/P&gt;</description>
      <pubDate>Mon, 13 Nov 2017 19:31:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-skip-the-first-two-quot-n-quot-letters-from-my-fields/m-p/368887#M108721</guid>
      <dc:creator>danielgp89</dc:creator>
      <dc:date>2017-11-13T19:31:01Z</dc:date>
    </item>
    <item>
      <title>Re: How can I skip the first two "\n" letters from my fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-skip-the-first-two-quot-n-quot-letters-from-my-fields/m-p/368888#M108722</link>
      <description>&lt;P&gt;Thanks so much!&lt;/P&gt;

&lt;P&gt;Best Regards!&lt;/P&gt;</description>
      <pubDate>Mon, 13 Nov 2017 19:31:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-skip-the-first-two-quot-n-quot-letters-from-my-fields/m-p/368888#M108722</guid>
      <dc:creator>danielgp89</dc:creator>
      <dc:date>2017-11-13T19:31:22Z</dc:date>
    </item>
    <item>
      <title>Re: How can I skip the first two "\n" letters from my fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-skip-the-first-two-quot-n-quot-letters-from-my-fields/m-p/368889#M108723</link>
      <description>&lt;P&gt;This is neater than mine. +1&lt;/P&gt;</description>
      <pubDate>Mon, 13 Nov 2017 19:37:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-skip-the-first-two-quot-n-quot-letters-from-my-fields/m-p/368889#M108723</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-11-13T19:37:34Z</dc:date>
    </item>
    <item>
      <title>Re: How can I skip the first two "\n" letters from my fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-skip-the-first-two-quot-n-quot-letters-from-my-fields/m-p/368890#M108724</link>
      <description>&lt;P&gt;@somesoni2, it is neat, but performance wise yours is better because you are performing the replace after the stats (hence working on less events rather than all). On similar lines, following would be a faster search.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;BaseSearch&amp;gt;
 | stats count by jobname
 | eval jobname=ltrim(foo,"\n") 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 13 Nov 2017 20:12:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-skip-the-first-two-quot-n-quot-letters-from-my-fields/m-p/368890#M108724</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-11-13T20:12:15Z</dc:date>
    </item>
    <item>
      <title>Re: How can I skip the first two "\n" letters from my fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-skip-the-first-two-quot-n-quot-letters-from-my-fields/m-p/368891#M108725</link>
      <description>&lt;P&gt;Here we go: three Fezzes make up a perfect answer &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Nov 2017 20:21:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-skip-the-first-two-quot-n-quot-letters-from-my-fields/m-p/368891#M108725</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2017-11-13T20:21:14Z</dc:date>
    </item>
  </channel>
</rss>

