<?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 Turning a table [Transpose] in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Turning-a-table-Transpose/m-p/30738#M6267</link>
    <description>&lt;P&gt;Is there a generic way to simply flip a table around the top-left to bottom-right diagonal axis?&lt;/P&gt;

&lt;P&gt;For instance, if I had this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;name b c d e f
foo  1 2 3 4 5
bar  5 4 3 2 1
la   9 8 7 6 5
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And I instead want this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;name foo bar la
b    1   5   9
c    2   4   8
d    3   3   7
e    4   2   6
f    5   1   5
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 09 Aug 2013 18:51:47 GMT</pubDate>
    <dc:creator>vbumgarner</dc:creator>
    <dc:date>2013-08-09T18:51:47Z</dc:date>
    <item>
      <title>Turning a table [Transpose]</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Turning-a-table-Transpose/m-p/30738#M6267</link>
      <description>&lt;P&gt;Is there a generic way to simply flip a table around the top-left to bottom-right diagonal axis?&lt;/P&gt;

&lt;P&gt;For instance, if I had this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;name b c d e f
foo  1 2 3 4 5
bar  5 4 3 2 1
la   9 8 7 6 5
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And I instead want this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;name foo bar la
b    1   5   9
c    2   4   8
d    3   3   7
e    4   2   6
f    5   1   5
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 09 Aug 2013 18:51:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Turning-a-table-Transpose/m-p/30738#M6267</guid>
      <dc:creator>vbumgarner</dc:creator>
      <dc:date>2013-08-09T18:51:47Z</dc:date>
    </item>
    <item>
      <title>Re: Turning a table [Transpose]</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Turning-a-table-Transpose/m-p/30739#M6268</link>
      <description>&lt;P&gt;&lt;A href="http://splunk-base.splunk.com/answers/13009/can-i-format-a-table-in-reverse-field-headings-by-row-not-by-columns"&gt;http://splunk-base.splunk.com/answers/13009/can-i-format-a-table-in-reverse-field-headings-by-row-not-by-columns&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Aug 2013 19:22:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Turning-a-table-Transpose/m-p/30739#M6268</guid>
      <dc:creator>davecroto</dc:creator>
      <dc:date>2013-08-09T19:22:39Z</dc:date>
    </item>
    <item>
      <title>Re: Turning a table [Transpose]</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Turning-a-table-Transpose/m-p/30740#M6269</link>
      <description>&lt;P&gt;I think the transpose command will work&lt;/P&gt;</description>
      <pubDate>Fri, 09 Aug 2013 19:59:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Turning-a-table-Transpose/m-p/30740#M6269</guid>
      <dc:creator>sdaniels</dc:creator>
      <dc:date>2013-08-09T19:59:01Z</dc:date>
    </item>
    <item>
      <title>Re: Turning a table [Transpose]</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Turning-a-table-Transpose/m-p/30741#M6270</link>
      <description>&lt;P&gt;Transpose will work but you need to rename the new column names and have to filter out the actual column names which will come in the first row.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Aug 2013 20:26:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Turning-a-table-Transpose/m-p/30741#M6270</guid>
      <dc:creator>linu1988</dc:creator>
      <dc:date>2013-08-09T20:26:11Z</dc:date>
    </item>
    <item>
      <title>Re: Turning a table [Transpose]</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Turning-a-table-Transpose/m-p/30742#M6271</link>
      <description>&lt;P&gt;Here's python that would do it, but I was hoping there was already a command included that does that natively:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;import csv
import sys

output = []

csvreader = csv.reader(sys.stdin)
for rowidx, row in enumerate(csvreader):
    for cellidx, cell in enumerate(row):
        if rowidx is 0:
            output.append([cell])
        else:
            output[cellidx].append( cell )

csvwriter = csv.writer(sys.stdout)
for row in output:
    csvwriter.writerow(row)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 09 Aug 2013 20:35:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Turning-a-table-Transpose/m-p/30742#M6271</guid>
      <dc:creator>vbumgarner</dc:creator>
      <dc:date>2013-08-09T20:35:22Z</dc:date>
    </item>
    <item>
      <title>Re: Turning a table [Transpose]</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Turning-a-table-Transpose/m-p/30743#M6272</link>
      <description>&lt;P&gt;I have come accross something similar myself &lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;... | stats max(field1) as foo max(field2) as bar max(field3) as la by name | transpose&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;gives me the below :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; column row 1 row 2 row3
 name foo bar la
 b    1   5   9
 c    2   4   8
 d    3   3   7
 e    4   2   6
 f    5   1   5
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;but I dont want "column row 1 row 2 row3" as my column headers I want     " name foo bar la" as my column headers&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;....| transpose | rename column as name | rename "row 1" as foo  | rename "row 2" as bar | rename "row 3" as ls&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;But now I have to work out a way to remove row1 " name foo bar la" after I have renamed the column headers&lt;/P&gt;

&lt;P&gt;Which will hopefull give me this: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; name foo bar la
  b    1   5   9
  c    2   4   8
  d    3   3   7
  e    4   2   6
  f    5   1   5
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 04 Jun 2015 02:16:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Turning-a-table-Transpose/m-p/30743#M6272</guid>
      <dc:creator>HattrickNZ</dc:creator>
      <dc:date>2015-06-04T02:16:30Z</dc:date>
    </item>
    <item>
      <title>Re: Turning a table [Transpose]</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Turning-a-table-Transpose/m-p/30744#M6273</link>
      <description>&lt;P&gt;@linu1988 how do you filter out the "column names whcih will come in the first row"?&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jun 2015 02:17:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Turning-a-table-Transpose/m-p/30744#M6273</guid>
      <dc:creator>HattrickNZ</dc:creator>
      <dc:date>2015-06-04T02:17:30Z</dc:date>
    </item>
  </channel>
</rss>

