<?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 do I use rex to extract filenames from UNC paths? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-rex-to-extract-filenames-from-UNC-paths/m-p/206118#M59978</link>
    <description>&lt;P&gt;That is 400 different types of awesome!&lt;BR /&gt;
Thanks so much! &lt;BR /&gt;
:)&lt;/P&gt;</description>
    <pubDate>Fri, 10 Jun 2016 09:11:06 GMT</pubDate>
    <dc:creator>mrgibbon</dc:creator>
    <dc:date>2016-06-10T09:11:06Z</dc:date>
    <item>
      <title>How do I use rex to extract filenames from UNC paths?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-rex-to-extract-filenames-from-UNC-paths/m-p/206116#M59976</link>
      <description>&lt;P&gt;Hi All, &lt;/P&gt;

&lt;P&gt;I've looked at quite a few answers to this issue and none seem to work for me.&lt;/P&gt;

&lt;P&gt;Data Sample:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;\\BLAH01\BLAH\ACN\BLAH\Dataline\PARADOX.LCK
\\BLAH01\Group\BLAH\ACN\BLAH\Dataline\PARADOX.LCK
\\BLAH01\Groups\BLAH\ACN\BLAH\Dataline\PARADOX.LCK
\\BLAH02\BLAH\documents\BLAH\Documents\Virtual Machines\coreos\coreos.vmx
\\BLAH02\BLAH\documents\BLAH\Documents\Virtual Machines\Windows XP Professional x64 Edition\Windows XP Professional x64 Edition.vmx
\\BLAH02\BLAH\documents\BLAH\Documents\Virtual Machines\Windows XP Professional x64 Edition\Windows XP Professional x64 Edition.nvram
\\BLAH02\BLAH\x\BLAH\VMware\VMware_Horizon6\ACP!5C!s_BLAH.vmdk
\\BLAH02\BLAH\RAMS\$Research\BLAH\ACN\BLAH\Dataline\PARADOX.LCK
\\BLAH02\BLAH\Fil01\e_ev\Group\BLAH\Backups\Copy of BLAH\index.asp.LCK
\\BLAH02\BLAH\Fil01\d_ev\Users\BLAH\old pc files\BLAH\Local Settings\Application Data\Microsoft\Silverlight\mssl.lck 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I just need a simple rex to pull out the filenames.&lt;BR /&gt;
It should be easy, but it's taking me forever.&lt;BR /&gt;
Can anyone help?&lt;/P&gt;

&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jun 2016 05:21:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-rex-to-extract-filenames-from-UNC-paths/m-p/206116#M59976</guid>
      <dc:creator>mrgibbon</dc:creator>
      <dc:date>2016-06-10T05:21:27Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use rex to extract filenames from UNC paths?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-rex-to-extract-filenames-from-UNC-paths/m-p/206117#M59977</link>
      <description>&lt;P&gt;See if the following helps:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=yourfieldname "(?&amp;lt;filename&amp;gt;[^\\\]+$)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Example:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats count | fields - count
| eval raw = "
\\BLAH01\BLAH\ACN\BLAH\Dataline\PARADOX.LCK;
\\BLAH01\Group\BLAH\ACN\BLAH\Dataline\PARADOX.LCK;
\\BLAH01\Groups\BLAH\ACN\BLAH\Dataline\PARADOX.LCK;
\\BLAH02\BLAH\documents\BLAH\Documents\Virtual Machines\coreos\coreos.vmx;
\\BLAH02\BLAH\documents\BLAH\Documents\Virtual Machines\Windows XP Professional x64 Edition\Windows XP Professional x64 Edition.vmx;
\\BLAH02\BLAH\documents\BLAH\Documents\Virtual Machines\Windows XP Professional x64 Edition\Windows XP Professional x64 Edition.nvram;
\\BLAH02\BLAH\x\BLAH\VMware\VMware_Horizon6\ACP!5C!s_BLAH.vmdk;
\\BLAH02\BLAH\RAMS\$Research\BLAH\ACN\BLAH\Dataline\PARADOX.LCK;
\\BLAH02\BLAH\Fil01\e_ev\Group\BLAH\Backups\Copy of BLAH\index.asp.LCK;
\\BLAH02\BLAH\Fil01\d_ev\Users\BLAH\old pc files\BLAH\Local Settings\Application Data\Microsoft\Silverlight\mssl.lck
"
| makemv delim=";" raw
| mvexpand raw
| rex field=raw "(?&amp;lt;filename&amp;gt;[^\\\]+$)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Output: see picture&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/1464i6359020B2D62587C/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>Fri, 10 Jun 2016 07:01:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-rex-to-extract-filenames-from-UNC-paths/m-p/206117#M59977</guid>
      <dc:creator>javiergn</dc:creator>
      <dc:date>2016-06-10T07:01:32Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use rex to extract filenames from UNC paths?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-rex-to-extract-filenames-from-UNC-paths/m-p/206118#M59978</link>
      <description>&lt;P&gt;That is 400 different types of awesome!&lt;BR /&gt;
Thanks so much! &lt;BR /&gt;
:)&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jun 2016 09:11:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-rex-to-extract-filenames-from-UNC-paths/m-p/206118#M59978</guid>
      <dc:creator>mrgibbon</dc:creator>
      <dc:date>2016-06-10T09:11:06Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use rex to extract filenames from UNC paths?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-rex-to-extract-filenames-from-UNC-paths/m-p/206119#M59979</link>
      <description>&lt;P&gt;Is there a way of getting the path without the filename on the end? &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jun 2016 09:13:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-rex-to-extract-filenames-from-UNC-paths/m-p/206119#M59979</guid>
      <dc:creator>mrgibbon</dc:creator>
      <dc:date>2016-06-10T09:13:37Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use rex to extract filenames from UNC paths?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-rex-to-extract-filenames-from-UNC-paths/m-p/206120#M59980</link>
      <description>&lt;P&gt;Yes, try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=yourfieldname "(?&amp;lt;path&amp;gt;.+)\\\(?&amp;lt;filename&amp;gt;[^\\\]+$)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Keep in mind Splunk is replacing the double backslash with single backslash on my example, but the principle is the same anyway.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jun 2016 11:09:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-rex-to-extract-filenames-from-UNC-paths/m-p/206120#M59980</guid>
      <dc:creator>javiergn</dc:creator>
      <dc:date>2016-06-10T11:09:12Z</dc:date>
    </item>
  </channel>
</rss>

