<?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 extract only the part of  filename using regex expression? in Splunk Enterprise</title>
    <link>https://community.splunk.com/t5/Splunk-Enterprise/How-to-extract-only-the-part-of-filename-using-regex-expression/m-p/541226#M5039</link>
    <description>&lt;P&gt;The following run-anywhere search string uses a rex command which will produce the results you want from the two examples provided:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults 
| eval source="a+b.zgeypynd.pcsdatei.600.gpg.1.20210127014546.gpg"
| rex field=source "^[^\.]*\.(?&amp;lt;filename&amp;gt;.*\.600)"&lt;/LI-CODE&gt;&lt;P&gt;The first part &amp;nbsp;&lt;STRONG&gt;^[^.]*\.&lt;/STRONG&gt; &amp;nbsp;is used to get rid of anything before the first .&lt;/P&gt;&lt;P&gt;The rest just captures the file name unto and including the 600.&lt;/P&gt;&lt;P&gt;This is also assuming that the filename is in the source , since what you seems to indicate that, but you can substitute whatever field works.&lt;/P&gt;</description>
    <pubDate>Wed, 24 Feb 2021 14:37:13 GMT</pubDate>
    <dc:creator>cpetterborg</dc:creator>
    <dc:date>2021-02-24T14:37:13Z</dc:date>
    <item>
      <title>How to extract only the part of  filename using regex expression?</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/How-to-extract-only-the-part-of-filename-using-regex-expression/m-p/541005#M5019</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;I have following file indexed&lt;/P&gt;&lt;DIV&gt;&lt;OL&gt;&lt;LI&gt;rw-r--r-- 1 dmu interface 7206 Jan 27 01:46 a+b.zgeypynd.pcsdatei.600.gpg.1.20210127014546.gpg&lt;/LI&gt;&lt;LI&gt;rw-r--r-- 1 dum&amp;nbsp; interface 366Jan 27 02:45 c+d.zpettime.abcdpd1fo.600.2.20210127020002.gpg.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;I need to capture only the following part from the filename&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&amp;nbsp;zpettime.abcdpd1fo.600&lt;/LI&gt;&lt;LI&gt;zgeypynd.pcsdatei.600&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;I am using this regex which is helping to capture only the filename from source i.e.a+b.zgeypynd.pcsdatei.600.gpg.1.20210127014546.gpg&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;| rex field=source ".*\/(?&amp;lt;filename&amp;gt;.*)$"&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;I want to extract after the first dot(.) till 600 number of the filename i.e.&amp;nbsp;&lt;STRONG&gt;zgeypynd.pcsdatei.600 . P&lt;/STRONG&gt;lease help me with rex expression&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 23 Feb 2021 14:19:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/How-to-extract-only-the-part-of-filename-using-regex-expression/m-p/541005#M5019</guid>
      <dc:creator>Ashwini008</dc:creator>
      <dc:date>2021-02-23T14:19:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract only the part of  filename using regex expression?</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/How-to-extract-only-the-part-of-filename-using-regex-expression/m-p/541017#M5021</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/222977"&gt;@Ashwini008&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;You can use below sample props.conf and transforms.conf in your indexers; you may need to play with regex to capture the correct part of filename.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;props.conf
[source::///dmd/archivy/*.gpg]
TRANSFORMS-replace_source = replacesourcefilename

transforms.conf
[replacesourcefilename]
SOURCE_KEY = MetaData:Source
REGEX = \w\+\w\.(\w+\.\w+.\d+)\.
DEST_KEY = MetaData:Source
FORMAT= source::$1.gpg&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Feb 2021 14:23:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/How-to-extract-only-the-part-of-filename-using-regex-expression/m-p/541017#M5021</guid>
      <dc:creator>scelikok</dc:creator>
      <dc:date>2021-02-23T14:23:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract only the part of  filename using regex expression?</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/How-to-extract-only-the-part-of-filename-using-regex-expression/m-p/541114#M5030</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/206061"&gt;@scelikok&lt;/a&gt;&amp;nbsp;Thank you but i am seeking help on regex expression .&lt;/P&gt;&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/172708"&gt;@martin_mueller&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/120445"&gt;@cpetterborg&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/15147"&gt;@somesoni2&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/213957"&gt;@richgalloway&lt;/a&gt;&amp;nbsp;could you please suggest?&lt;/P&gt;</description>
      <pubDate>Wed, 24 Feb 2021 05:17:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/How-to-extract-only-the-part-of-filename-using-regex-expression/m-p/541114#M5030</guid>
      <dc:creator>Ashwini008</dc:creator>
      <dc:date>2021-02-24T05:17:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract only the part of  filename using regex expression?</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/How-to-extract-only-the-part-of-filename-using-regex-expression/m-p/541116#M5032</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/222977"&gt;@Ashwini008&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;It was mentioned indexing before, that is why I put conf files. You can use below rex command;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;|rex field=source "\w\+\w\.(?&amp;lt;filename&amp;gt;\w+\.\w+.\d+)\."&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 24 Feb 2021 05:41:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/How-to-extract-only-the-part-of-filename-using-regex-expression/m-p/541116#M5032</guid>
      <dc:creator>scelikok</dc:creator>
      <dc:date>2021-02-24T05:41:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract only the part of  filename using regex expression?</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/How-to-extract-only-the-part-of-filename-using-regex-expression/m-p/541119#M5033</link>
      <description>&lt;P class="lia-indent-padding-left-30px"&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/206061"&gt;@scelikok&lt;/a&gt;&amp;nbsp;Thank you . It worked as expected.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Feb 2021 06:07:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/How-to-extract-only-the-part-of-filename-using-regex-expression/m-p/541119#M5033</guid>
      <dc:creator>Ashwini008</dc:creator>
      <dc:date>2021-02-24T06:07:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract only the part of  filename using regex expression?</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/How-to-extract-only-the-part-of-filename-using-regex-expression/m-p/541138#M5035</link>
      <description>&lt;P&gt;Here is an other regex.&amp;nbsp; It uses the time as reference, then skip all until first dot.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;\d+:\d+ [^.]+\.(?&amp;lt;file&amp;gt;.*?\d+)\.&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Feb 2021 08:58:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/How-to-extract-only-the-part-of-filename-using-regex-expression/m-p/541138#M5035</guid>
      <dc:creator>jotne</dc:creator>
      <dc:date>2021-02-24T08:58:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract only the part of  filename using regex expression?</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/How-to-extract-only-the-part-of-filename-using-regex-expression/m-p/541226#M5039</link>
      <description>&lt;P&gt;The following run-anywhere search string uses a rex command which will produce the results you want from the two examples provided:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults 
| eval source="a+b.zgeypynd.pcsdatei.600.gpg.1.20210127014546.gpg"
| rex field=source "^[^\.]*\.(?&amp;lt;filename&amp;gt;.*\.600)"&lt;/LI-CODE&gt;&lt;P&gt;The first part &amp;nbsp;&lt;STRONG&gt;^[^.]*\.&lt;/STRONG&gt; &amp;nbsp;is used to get rid of anything before the first .&lt;/P&gt;&lt;P&gt;The rest just captures the file name unto and including the 600.&lt;/P&gt;&lt;P&gt;This is also assuming that the filename is in the source , since what you seems to indicate that, but you can substitute whatever field works.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Feb 2021 14:37:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/How-to-extract-only-the-part-of-filename-using-regex-expression/m-p/541226#M5039</guid>
      <dc:creator>cpetterborg</dc:creator>
      <dc:date>2021-02-24T14:37:13Z</dc:date>
    </item>
  </channel>
</rss>

