<?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 write the regex to remove the filename and only return the path from my data? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-the-regex-to-remove-the-filename-and-only-return/m-p/126972#M34410</link>
    <description>&lt;P&gt;Give this a try&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=yourfieldname  "(?&amp;lt;Path&amp;gt;.*)\\\\"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;See this runanywhere splunk search&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| gentimes start=-1 | eval path="C:\path\path\path\path\application.exe" | table path | rex field=path "(?&amp;lt;Path&amp;gt;.*)\\\\"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 03 Apr 2015 17:16:33 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2015-04-03T17:16:33Z</dc:date>
    <item>
      <title>How to write the regex to remove the filename and only return the path from my data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-the-regex-to-remove-the-filename-and-only-return/m-p/126971#M34409</link>
      <description>&lt;P&gt;I'm trying to remove the filename from path and return path only in Splunk&lt;/P&gt;

&lt;P&gt;example:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;`C:\path\path\path\path\application.exe`
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;the path is variable length. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;`| regex mypath="[^.*\/].*" |`
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;not only does my syntax for the command between splunk pipes not work, but the syntax for regex argument is incorrect as well. any help appreciated. &lt;/P&gt;</description>
      <pubDate>Fri, 03 Apr 2015 17:03:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-the-regex-to-remove-the-filename-and-only-return/m-p/126971#M34409</guid>
      <dc:creator>kleckns</dc:creator>
      <dc:date>2015-04-03T17:03:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to write the regex to remove the filename and only return the path from my data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-the-regex-to-remove-the-filename-and-only-return/m-p/126972#M34410</link>
      <description>&lt;P&gt;Give this a try&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=yourfieldname  "(?&amp;lt;Path&amp;gt;.*)\\\\"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;See this runanywhere splunk search&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| gentimes start=-1 | eval path="C:\path\path\path\path\application.exe" | table path | rex field=path "(?&amp;lt;Path&amp;gt;.*)\\\\"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 03 Apr 2015 17:16:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-the-regex-to-remove-the-filename-and-only-return/m-p/126972#M34410</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2015-04-03T17:16:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to write the regex to remove the filename and only return the path from my data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-the-regex-to-remove-the-filename-and-only-return/m-p/126973#M34411</link>
      <description>&lt;P&gt;That worked. Thank you very much. &lt;/P&gt;</description>
      <pubDate>Fri, 03 Apr 2015 17:26:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-the-regex-to-remove-the-filename-and-only-return/m-p/126973#M34411</guid>
      <dc:creator>kleckns</dc:creator>
      <dc:date>2015-04-03T17:26:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to write the regex to remove the filename and only return the path from my data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-the-regex-to-remove-the-filename-and-only-return/m-p/566486#M197419</link>
      <description>&lt;P&gt;You probably already have your solution in 2021, but anyway, here's a solution:&lt;/P&gt;&lt;P&gt;| makeresults&lt;BR /&gt;| eval path="/opt/splunk/etc/system/local/inputs.conf"&lt;BR /&gt;| eval base_path=replace(path,"\/[^\/]+\.[^\/]+$","")&lt;BR /&gt;| table path base_path&lt;/P&gt;</description>
      <pubDate>Thu, 09 Sep 2021 15:55:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-the-regex-to-remove-the-filename-and-only-return/m-p/566486#M197419</guid>
      <dc:creator>judevine</dc:creator>
      <dc:date>2021-09-09T15:55:19Z</dc:date>
    </item>
  </channel>
</rss>

