<?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 regex on field names? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-regex-on-field-names/m-p/454659#M128631</link>
    <description>&lt;P&gt;Try like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your current search giving table in first screenshot
| untable _time fieldname fieldval
| eval fieldname=replace(fieldname,"^(.+_)(Avg_.+)","\2") 
| xyseries _time fieldname fieldval
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If above works for you, look at definition of untable/xyseries command here, to understand the usage better:&lt;BR /&gt;
&lt;A href="http://docs.splunk.com/Documentation/SplunkLight/7.1.2/References/Listofsearchcommands"&gt;http://docs.splunk.com/Documentation/SplunkLight/7.1.2/References/Listofsearchcommands&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 11 Sep 2018 20:25:57 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2018-09-11T20:25:57Z</dc:date>
    <item>
      <title>How to use regex on field names?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-regex-on-field-names/m-p/454654#M128626</link>
      <description>&lt;P&gt;For example.&lt;/P&gt;

&lt;P&gt;Is there any way to convert this:&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/5750i33C08416D131B4DB/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;into this?&lt;/P&gt;

&lt;P&gt;Don't care about the numbers but the value of the second column (new) is a substr of the previous headers. Of course there are many other different "Disks".&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/5751i543DB6B30525FA69/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Sep 2018 18:53:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-regex-on-field-names/m-p/454654#M128626</guid>
      <dc:creator>tamakg</dc:creator>
      <dc:date>2018-09-11T18:53:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to use regex on field names?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-regex-on-field-names/m-p/454655#M128627</link>
      <description>&lt;P&gt;If you can provide a sample event we can probably figure this out.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Sep 2018 19:34:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-regex-on-field-names/m-p/454655#M128627</guid>
      <dc:creator>jodyfsu</dc:creator>
      <dc:date>2018-09-11T19:34:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to use regex on field names?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-regex-on-field-names/m-p/454656#M128628</link>
      <description>&lt;P&gt;Here is the sample: &lt;A href="https://1drv.ms/u/s!AsmV0Jvla5SrgW-CydStfrht3ep6"&gt;https://1drv.ms/u/s!AsmV0Jvla5SrgW-CydStfrht3ep6&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Sep 2018 20:03:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-regex-on-field-names/m-p/454656#M128628</guid>
      <dc:creator>tamakg</dc:creator>
      <dc:date>2018-09-11T20:03:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to use regex on field names?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-regex-on-field-names/m-p/454657#M128629</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;| rex field=PhysicalDisk_0_C_Avg__Disk_Bytes_Read "(?&amp;lt;DRIVE&amp;gt;\w+\_\d\_\w)\_(?&amp;lt;AVDBR&amp;gt;.[^\s]+)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 11 Sep 2018 20:24:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-regex-on-field-names/m-p/454657#M128629</guid>
      <dc:creator>jodyfsu</dc:creator>
      <dc:date>2018-09-11T20:24:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to use regex on field names?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-regex-on-field-names/m-p/454658#M128630</link>
      <description>&lt;P&gt;See if that works.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Sep 2018 20:25:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-regex-on-field-names/m-p/454658#M128630</guid>
      <dc:creator>jodyfsu</dc:creator>
      <dc:date>2018-09-11T20:25:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to use regex on field names?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-regex-on-field-names/m-p/454659#M128631</link>
      <description>&lt;P&gt;Try like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your current search giving table in first screenshot
| untable _time fieldname fieldval
| eval fieldname=replace(fieldname,"^(.+_)(Avg_.+)","\2") 
| xyseries _time fieldname fieldval
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If above works for you, look at definition of untable/xyseries command here, to understand the usage better:&lt;BR /&gt;
&lt;A href="http://docs.splunk.com/Documentation/SplunkLight/7.1.2/References/Listofsearchcommands"&gt;http://docs.splunk.com/Documentation/SplunkLight/7.1.2/References/Listofsearchcommands&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Sep 2018 20:25:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-regex-on-field-names/m-p/454659#M128631</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2018-09-11T20:25:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to use regex on field names?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-regex-on-field-names/m-p/454660#M128632</link>
      <description>&lt;P&gt;Almost there. Missing the "removed field prefix" as a new column value.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Sep 2018 20:39:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-regex-on-field-names/m-p/454660#M128632</guid>
      <dc:creator>tamakg</dc:creator>
      <dc:date>2018-09-11T20:39:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to use regex on field names?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-regex-on-field-names/m-p/454661#M128633</link>
      <description>&lt;P&gt;Nope. New fields are empty...&lt;/P&gt;</description>
      <pubDate>Tue, 11 Sep 2018 20:41:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-regex-on-field-names/m-p/454661#M128633</guid>
      <dc:creator>tamakg</dc:creator>
      <dc:date>2018-09-11T20:41:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to use regex on field names?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-regex-on-field-names/m-p/454662#M128634</link>
      <description>&lt;P&gt;I didn't understand. What are you getting now and what's expected?&lt;/P&gt;</description>
      <pubDate>Tue, 11 Sep 2018 20:48:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-regex-on-field-names/m-p/454662#M128634</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2018-09-11T20:48:26Z</dc:date>
    </item>
  </channel>
</rss>

