<?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 use rex and sed to insert '-' and ':' in the result? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-rex-and-sed-to-insert-and-in-the-result/m-p/151055#M42325</link>
    <description>&lt;P&gt;What is the Splunk query that is failing?&lt;/P&gt;</description>
    <pubDate>Mon, 15 Jun 2015 11:45:20 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2015-06-15T11:45:20Z</dc:date>
    <item>
      <title>How to use rex and sed to insert '-' and ':' in the result?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-rex-and-sed-to-insert-and-in-the-result/m-p/151054#M42324</link>
      <description>&lt;P&gt;Hi, I'm new to Splunk. I have a query that extracts the date and time from the name of a log file. Logfile names are like e.g. XXXXXXXX_20150615133030.log. My query successfully returns the desired output which is 20150615133030. This is as per my requirement.&lt;/P&gt;

&lt;P&gt;Now, i would like to edit the number to show like this -- "2015-06-15 13:30:30".&lt;BR /&gt;
I tried the following command in bash prompt and it works -- &lt;CODE&gt;sed 's/^\(.\{4\}\)\(.\{2\}\)\(.\{2\}\)\(.\{2\}\)\(.\{2\}\)/\1-\2-\3 \4:\5:/g' numbers.txt&lt;/CODE&gt; and it works fine. But this is not working when i use it in my Splunk query.&lt;/P&gt;

&lt;P&gt;Please answer if anyone knows. Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jun 2015 11:32:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-rex-and-sed-to-insert-and-in-the-result/m-p/151054#M42324</guid>
      <dc:creator>nilotpaldutta</dc:creator>
      <dc:date>2015-06-15T11:32:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to use rex and sed to insert '-' and ':' in the result?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-rex-and-sed-to-insert-and-in-the-result/m-p/151055#M42325</link>
      <description>&lt;P&gt;What is the Splunk query that is failing?&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jun 2015 11:45:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-rex-and-sed-to-insert-and-in-the-result/m-p/151055#M42325</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2015-06-15T11:45:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to use rex and sed to insert '-' and ':' in the result?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-rex-and-sed-to-insert-and-in-the-result/m-p/151056#M42326</link>
      <description>&lt;P&gt;Also, why don't you edit your &lt;STRONG&gt;props.conf&lt;/STRONG&gt; for it? I think it will be easy!&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jun 2015 11:50:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-rex-and-sed-to-insert-and-in-the-result/m-p/151056#M42326</guid>
      <dc:creator>stephanefotso</dc:creator>
      <dc:date>2015-06-15T11:50:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to use rex and sed to insert '-' and ':' in the result?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-rex-and-sed-to-insert-and-in-the-result/m-p/151057#M42327</link>
      <description>&lt;P&gt;&lt;CODE&gt;index=myindex | dedup source | sort -source | dedup sourcetype | rex field=source mode=sed "s/[^0-9]*//g" | rename source as date | rex field=date mode=sed "s/(\d{4}-){1}/2015-/g" | table sourcetype, date&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;source and sourcetype are two fields i'm retrieving.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jun 2015 12:04:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-rex-and-sed-to-insert-and-in-the-result/m-p/151057#M42327</guid>
      <dc:creator>nilotpaldutta</dc:creator>
      <dc:date>2015-06-15T12:04:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to use rex and sed to insert '-' and ':' in the result?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-rex-and-sed-to-insert-and-in-the-result/m-p/151058#M42328</link>
      <description>&lt;P&gt;Thanks for your response. Can you please post an example?&lt;BR /&gt;
I'm not looking to standardize my output. Just need it once for the above query. &lt;BR /&gt;
I might be wrong but isn't editing any config file going to always return results of other queries also in one particular format?&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jun 2015 12:18:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-rex-and-sed-to-insert-and-in-the-result/m-p/151058#M42328</guid>
      <dc:creator>nilotpaldutta</dc:creator>
      <dc:date>2015-06-15T12:18:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to use rex and sed to insert '-' and ':' in the result?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-rex-and-sed-to-insert-and-in-the-result/m-p/151059#M42329</link>
      <description>&lt;P&gt;in the search query, the sed string is between double quotes. Therefore you have to escape or double escape some symbols.&lt;/P&gt;

&lt;P&gt;PS: in the props.conf you do not need the extra escape.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jun 2015 12:34:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-rex-and-sed-to-insert-and-in-the-result/m-p/151059#M42329</guid>
      <dc:creator>yannK</dc:creator>
      <dc:date>2015-06-15T12:34:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to use rex and sed to insert '-' and ':' in the result?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-rex-and-sed-to-insert-and-in-the-result/m-p/151060#M42330</link>
      <description>&lt;P&gt;Your search is failing because the &lt;CODE&gt;date&lt;/CODE&gt; field does not have a hyphen in it.  This should work (your original sed string has far too many escapes).&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;rex field=date mode=sed "s/(.{4})(.{2})(.{2})(.{2})(.{2})/\1-\2-\3 \4:\5:/"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 15 Jun 2015 12:51:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-rex-and-sed-to-insert-and-in-the-result/m-p/151060#M42330</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2015-06-15T12:51:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to use rex and sed to insert '-' and ':' in the result?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-rex-and-sed-to-insert-and-in-the-result/m-p/151061#M42331</link>
      <description>&lt;P&gt;Thank you. This works for me. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jun 2015 05:48:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-rex-and-sed-to-insert-and-in-the-result/m-p/151061#M42331</guid>
      <dc:creator>nilotpaldutta</dc:creator>
      <dc:date>2015-06-16T05:48:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to use rex and sed to insert '-' and ':' in the result?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-rex-and-sed-to-insert-and-in-the-result/m-p/151062#M42332</link>
      <description>&lt;P&gt;Please accept the answer.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jun 2015 12:30:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-rex-and-sed-to-insert-and-in-the-result/m-p/151062#M42332</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2015-06-16T12:30:15Z</dc:date>
    </item>
  </channel>
</rss>

