<?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 sort the column names alphabetically at the end of the search? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-the-column-names-alphabetically-at-the-end-of-the/m-p/437374#M124543</link>
    <description>&lt;P&gt;Yes you are absolutly right. Better to use &lt;CODE&gt;fields&lt;/CODE&gt; over &lt;CODE&gt;table&lt;/CODE&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 12 Mar 2019 02:01:56 GMT</pubDate>
    <dc:creator>chrisyounger</dc:creator>
    <dc:date>2019-03-12T02:01:56Z</dc:date>
    <item>
      <title>How to sort the column names alphabetically at the end of the search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-the-column-names-alphabetically-at-the-end-of-the/m-p/437371#M124540</link>
      <description>&lt;P&gt;This is my sample search: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
     | eval data = "
1-Sep    657 34 35;
2-Sep    434 34 35;
    " 
     | makemv delim=";" data
     | mvexpand data
     | rex field=data "(?&amp;lt;Date&amp;gt;\d+-\w+)\s+(?&amp;lt;kpi1&amp;gt;\d+)\s+(?&amp;lt;kpi2&amp;gt;\d+)\s+(?&amp;lt;kpi3&amp;gt;\d+)"
     | fields + Date kpi1 kpi2 kpi3 | fields - _time
     | search kpi1 = * 
     |rename kpi1 as  "Incoming Calls in Mobile Office Directions - Call Release by Bearer Fail Times" 
     | rename kpi2 as "Incoming Calls in Mobile Office Directions - Common Resources Application Failures" 
     | rename kpi3 as "Incoming Calls in Mobile Office Directions - Assignment Failures"
     | &amp;lt;command(s) goes here&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This gives me the columns in the following order - left to right&lt;BR /&gt;&lt;BR /&gt;
1/&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Date    
Incoming Calls in Mobile Office Directions - Call Release by Bearer Fail Times  
Incoming Calls in Mobile Office Directions - Common Resources Application Failures  
Incoming Calls in Mobile Office Directions - Assignment Failures
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Is there a command that I can add on that will sort these alphabetically to give me &lt;BR /&gt;
2/&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Date    
Incoming Calls in Mobile Office Directions - Assignment Failures
Incoming Calls in Mobile Office Directions - Call Release by Bearer Fail Times
Incoming Calls in Mobile Office Directions - Common Resources Application Failures
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I know I can reorder the kpis  in this part of the search &lt;BR /&gt;
&lt;CODE&gt;| fields + Date kpi1 kpi2 kpi3 |&lt;/CODE&gt; &lt;BR /&gt;
But my question is more about after that and putting a specific command or commands to sort it alphabetically as 2/ above.&lt;BR /&gt;
&lt;CODE&gt;| &amp;lt;command(s) goes here&amp;gt;&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Mar 2019 01:00:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-sort-the-column-names-alphabetically-at-the-end-of-the/m-p/437371#M124540</guid>
      <dc:creator>HattrickNZ</dc:creator>
      <dc:date>2019-03-12T01:00:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to sort the column names alphabetically at the end of the search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-the-column-names-alphabetically-at-the-end-of-the/m-p/437372#M124541</link>
      <description>&lt;P&gt;You can use &lt;CODE&gt;*&lt;/CODE&gt; with table and it will do it in ascii order:&lt;/P&gt;

&lt;P&gt;e.g. &lt;CODE&gt;|table *&lt;/CODE&gt; (but this might have fields you need to remove with &lt;CODE&gt;|fields -&lt;/CODE&gt;)&lt;/P&gt;

&lt;P&gt;or &lt;CODE&gt;|table Date Inc*&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;All the best&lt;/P&gt;</description>
      <pubDate>Tue, 12 Mar 2019 01:06:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-sort-the-column-names-alphabetically-at-the-end-of-the/m-p/437372#M124541</guid>
      <dc:creator>chrisyounger</dc:creator>
      <dc:date>2019-03-12T01:06:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to sort the column names alphabetically at the end of the search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-the-column-names-alphabetically-at-the-end-of-the/m-p/437373#M124542</link>
      <description>&lt;P&gt;@chrisyoungerjds rather than using table a fields can be used directly, the same is anyways there in the current query:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval data = "
 1-Sep    657 34 35;
 2-Sep    434 34 35;
     " 
| makemv delim=";" data 
| mvexpand data 
| rex field=data "(?&amp;lt;Date&amp;gt;\d+-\w+)\s+(?&amp;lt;kpi1&amp;gt;\d+)\s+(?&amp;lt;kpi2&amp;gt;\d+)\s+(?&amp;lt;kpi3&amp;gt;\d+)" 
| fields - _time 
| search kpi1 = * 
| rename kpi1 as "Incoming Calls in Mobile Office Directions - Call Release by Bearer Fail Times" 
| rename kpi2 as "Incoming Calls in Mobile Office Directions - Common Resources Application Failures" 
| rename kpi3 as "Incoming Calls in Mobile Office Directions - Assignment Failures"
| fields + Date "Incoming Calls in Mobile Office Directions - *"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 12 Mar 2019 01:42:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-sort-the-column-names-alphabetically-at-the-end-of-the/m-p/437373#M124542</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2019-03-12T01:42:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to sort the column names alphabetically at the end of the search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-the-column-names-alphabetically-at-the-end-of-the/m-p/437374#M124543</link>
      <description>&lt;P&gt;Yes you are absolutly right. Better to use &lt;CODE&gt;fields&lt;/CODE&gt; over &lt;CODE&gt;table&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Mar 2019 02:01:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-sort-the-column-names-alphabetically-at-the-end-of-the/m-p/437374#M124543</guid>
      <dc:creator>chrisyounger</dc:creator>
      <dc:date>2019-03-12T02:01:56Z</dc:date>
    </item>
  </channel>
</rss>

