<?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 How to replace multiple column/field names with a `(` with an `_` underscore in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-replace-multiple-column-field-names-with-a-with-an/m-p/227325#M67143</link>
    <description>&lt;P&gt;I have a search that gives me a number of columns in the stats field. &lt;/P&gt;

&lt;P&gt;max(col1) max(col2) ...&lt;BR /&gt;
1 2 &lt;BR /&gt;
...&lt;/P&gt;

&lt;P&gt;Can I replace the brackets in the column/field names with underscore?&lt;/P&gt;

&lt;P&gt;max_col1_ max_col2_ ...&lt;BR /&gt;
1 2 &lt;BR /&gt;
...&lt;/P&gt;

&lt;P&gt;I have looked at &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.0.6/SearchReference/Replace" target="_blank"&gt;replace&lt;/A&gt; but that seems to work on the values in the field as opposed to the fieldname.&lt;BR /&gt;
I am looking for a generic way to do it as apposed to go through each field.&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 08:57:30 GMT</pubDate>
    <dc:creator>HattrickNZ</dc:creator>
    <dc:date>2020-09-29T08:57:30Z</dc:date>
    <item>
      <title>How to replace multiple column/field names with a `(` with an `_` underscore</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-replace-multiple-column-field-names-with-a-with-an/m-p/227325#M67143</link>
      <description>&lt;P&gt;I have a search that gives me a number of columns in the stats field. &lt;/P&gt;

&lt;P&gt;max(col1) max(col2) ...&lt;BR /&gt;
1 2 &lt;BR /&gt;
...&lt;/P&gt;

&lt;P&gt;Can I replace the brackets in the column/field names with underscore?&lt;/P&gt;

&lt;P&gt;max_col1_ max_col2_ ...&lt;BR /&gt;
1 2 &lt;BR /&gt;
...&lt;/P&gt;

&lt;P&gt;I have looked at &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.0.6/SearchReference/Replace" target="_blank"&gt;replace&lt;/A&gt; but that seems to work on the values in the field as opposed to the fieldname.&lt;BR /&gt;
I am looking for a generic way to do it as apposed to go through each field.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 08:57:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-replace-multiple-column-field-names-with-a-with-an/m-p/227325#M67143</guid>
      <dc:creator>HattrickNZ</dc:creator>
      <dc:date>2020-09-29T08:57:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace multiple column/field names with a `(` with an `_` underscore</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-replace-multiple-column-field-names-with-a-with-an/m-p/227326#M67144</link>
      <description>&lt;P&gt;Hi HattrickNZ,&lt;/P&gt;

&lt;P&gt;in your &lt;CODE&gt;stats&lt;/CODE&gt; command you can provide names for the result:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; your base search here | stats max(col1) AS max_col1 max(col2) AS max_col2  
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hope this helps ...&lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
      <pubDate>Wed, 02 Mar 2016 20:43:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-replace-multiple-column-field-names-with-a-with-an/m-p/227326#M67144</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2016-03-02T20:43:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace multiple column/field names with a `(` with an `_` underscore</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-replace-multiple-column-field-names-with-a-with-an/m-p/227327#M67145</link>
      <description>&lt;P&gt;tks Mus, sorry should have said, was looking for a more generic way. I am familliar with that method.&lt;/P&gt;</description>
      <pubDate>Wed, 02 Mar 2016 21:01:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-replace-multiple-column-field-names-with-a-with-an/m-p/227327#M67145</guid>
      <dc:creator>HattrickNZ</dc:creator>
      <dc:date>2016-03-02T21:01:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace multiple column/field names with a `(` with an `_` underscore</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-replace-multiple-column-field-names-with-a-with-an/m-p/227328#M67146</link>
      <description>&lt;P&gt;You can use the rename command with wildcard.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your current search giving column names max(col1) max(col2)... etc | rename max(*) as max_*
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 02 Mar 2016 21:05:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-replace-multiple-column-field-names-with-a-with-an/m-p/227328#M67146</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-03-02T21:05:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace multiple column/field names with a `(` with an `_` underscore</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-replace-multiple-column-field-names-with-a-with-an/m-p/227329#M67147</link>
      <description>&lt;P&gt;I reckon you should rephrase your question in this case; so we understand what you're looking for and also provide your search string.&lt;/P&gt;</description>
      <pubDate>Wed, 02 Mar 2016 21:07:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-replace-multiple-column-field-names-with-a-with-an/m-p/227329#M67147</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2016-03-02T21:07:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace multiple column/field names with a `(` with an `_` underscore</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-replace-multiple-column-field-names-with-a-with-an/m-p/227330#M67148</link>
      <description>&lt;P&gt;@MuS's solution is what the most optimum and recommended one (get the correct column name while generating columns).&lt;/P&gt;</description>
      <pubDate>Wed, 02 Mar 2016 21:26:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-replace-multiple-column-field-names-with-a-with-an/m-p/227330#M67148</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-03-02T21:26:19Z</dc:date>
    </item>
  </channel>
</rss>

