<?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: In a CSV file, how do you sort date and time separately? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/In-a-CSV-file-how-do-you-sort-date-and-time-separately/m-p/422862#M74263</link>
    <description>&lt;P&gt;Oh! Never mind! I already figured out what to do based on your last comment. and It really worked well!  thank you so much @vnravikumar !!&lt;/P&gt;</description>
    <pubDate>Wed, 06 Mar 2019 03:33:36 GMT</pubDate>
    <dc:creator>mdmaala</dc:creator>
    <dc:date>2019-03-06T03:33:36Z</dc:date>
    <item>
      <title>In a CSV file, how do you sort date and time separately?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/In-a-CSV-file-how-do-you-sort-date-and-time-separately/m-p/422856#M74257</link>
      <description>&lt;P&gt;hi! &lt;/P&gt;

&lt;P&gt;I have a CSV file that indicates Date and Time in one column and is displayed like this &lt;STRONG&gt;2019/03/05 17:05:04&lt;/STRONG&gt; I want to sort the date and time separately. &lt;/P&gt;

&lt;P&gt;is there any way I can do this? thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 06 Mar 2019 00:23:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/In-a-CSV-file-how-do-you-sort-date-and-time-separately/m-p/422856#M74257</guid>
      <dc:creator>mdmaala</dc:creator>
      <dc:date>2019-03-06T00:23:54Z</dc:date>
    </item>
    <item>
      <title>Re: In a CSV file, how do you sort date and time separately?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/In-a-CSV-file-how-do-you-sort-date-and-time-separately/m-p/422857#M74258</link>
      <description>&lt;P&gt;@mdmaala, try the following regular expression based extraction (with run anywhere example based on your data). If the field name is DateTime the regex extract two fields Date and Time separately.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval DateTime="2019/03/05 17:05:04"
| rex field=DateTime "^(?&amp;lt;Date&amp;gt;[^\s]+)\s(?&amp;lt;Time&amp;gt;.*)$"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 06 Mar 2019 01:52:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/In-a-CSV-file-how-do-you-sort-date-and-time-separately/m-p/422857#M74258</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2019-03-06T01:52:37Z</dc:date>
    </item>
    <item>
      <title>Re: In a CSV file, how do you sort date and time separately?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/In-a-CSV-file-how-do-you-sort-date-and-time-separately/m-p/422858#M74259</link>
      <description>&lt;P&gt;Hi @mdmaala&lt;/P&gt;

&lt;P&gt;You can try this rex also, it will result in two new columns &lt;CODE&gt;Date&lt;/CODE&gt; and &lt;CODE&gt;Time&lt;/CODE&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval date_time="2019/03/05 17:05:04" 
| rex field=date_time "(?P&amp;lt;Date&amp;gt;\d{4}\/\d{2}\/\d{2})\s(?P&amp;lt;Time&amp;gt;\d{2}\:\d{2}\:\d{2})"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 06 Mar 2019 02:07:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/In-a-CSV-file-how-do-you-sort-date-and-time-separately/m-p/422858#M74259</guid>
      <dc:creator>vnravikumar</dc:creator>
      <dc:date>2019-03-06T02:07:23Z</dc:date>
    </item>
    <item>
      <title>Re: In a CSV file, how do you sort date and time separately?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/In-a-CSV-file-how-do-you-sort-date-and-time-separately/m-p/422859#M74260</link>
      <description>&lt;P&gt;Thank you so much! it works perfectly. but how about if I want to separate the date and time for all the date and time included in the table? is that possible?&lt;/P&gt;</description>
      <pubDate>Wed, 06 Mar 2019 03:02:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/In-a-CSV-file-how-do-you-sort-date-and-time-separately/m-p/422859#M74260</guid>
      <dc:creator>mdmaala</dc:creator>
      <dc:date>2019-03-06T03:02:33Z</dc:date>
    </item>
    <item>
      <title>Re: In a CSV file, how do you sort date and time separately?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/In-a-CSV-file-how-do-you-sort-date-and-time-separately/m-p/422860#M74261</link>
      <description>&lt;P&gt;Hi @mdmaala, specify your datetime field in the rex statement &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your query...| rex field=date_time "(?P&amp;lt;Date&amp;gt;\d{4}\/\d{2}\/\d{2})\s(?P&amp;lt;Time&amp;gt;\d{2}\:\d{2}\:\d{2})"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;here &lt;CODE&gt;date_time&lt;/CODE&gt; is the field name that you want to split, It will give two fields &lt;CODE&gt;Date&lt;/CODE&gt; and &lt;CODE&gt;Time&lt;/CODE&gt;.&lt;BR /&gt;
 Please let me know if you need more info.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Mar 2019 03:07:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/In-a-CSV-file-how-do-you-sort-date-and-time-separately/m-p/422860#M74261</guid>
      <dc:creator>vnravikumar</dc:creator>
      <dc:date>2019-03-06T03:07:12Z</dc:date>
    </item>
    <item>
      <title>Re: In a CSV file, how do you sort date and time separately?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/In-a-CSV-file-how-do-you-sort-date-and-time-separately/m-p/422861#M74262</link>
      <description>&lt;P&gt;I see now I understand. In my table the field name is &lt;STRONG&gt;Date_Time&lt;/STRONG&gt; so what I did was this:&lt;/P&gt;

&lt;P&gt;source="C:\Users\NPIE-MDMAALA\Documents\PATLITE\*" host="DESKTOP-G546H69" sourcetype="csv" | rename "Green information" AS "Green" | rename "Amber information" AS "Amber" | rename "Red information" AS "Red" | rename "User name" AS Username | rename "MAC Address" AS "MAC_add" | rex field=Date_Time "(?P\d{4}\/\d{2}\/\d{2})\s(?P\d{2}:\d{2}:\d{2})" |&lt;/P&gt;

&lt;P&gt;is this correct?&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 23:34:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/In-a-CSV-file-how-do-you-sort-date-and-time-separately/m-p/422861#M74262</guid>
      <dc:creator>mdmaala</dc:creator>
      <dc:date>2020-09-29T23:34:35Z</dc:date>
    </item>
    <item>
      <title>Re: In a CSV file, how do you sort date and time separately?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/In-a-CSV-file-how-do-you-sort-date-and-time-separately/m-p/422862#M74263</link>
      <description>&lt;P&gt;Oh! Never mind! I already figured out what to do based on your last comment. and It really worked well!  thank you so much @vnravikumar !!&lt;/P&gt;</description>
      <pubDate>Wed, 06 Mar 2019 03:33:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/In-a-CSV-file-how-do-you-sort-date-and-time-separately/m-p/422862#M74263</guid>
      <dc:creator>mdmaala</dc:creator>
      <dc:date>2019-03-06T03:33:36Z</dc:date>
    </item>
  </channel>
</rss>

