<?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: rex to extract field from csv in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/rex-to-extract-field-from-csv/m-p/314188#M94034</link>
    <description>&lt;P&gt;Its not working giving me error at field2 as it has got comma inside the name i believe&lt;/P&gt;</description>
    <pubDate>Thu, 05 Apr 2018 11:52:15 GMT</pubDate>
    <dc:creator>surekhasplunk</dc:creator>
    <dc:date>2018-04-05T11:52:15Z</dc:date>
    <item>
      <title>rex to extract field from csv</title>
      <link>https://community.splunk.com/t5/Splunk-Search/rex-to-extract-field-from-csv/m-p/314185#M94031</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I want to extract below fields &lt;BR /&gt;
First 5 fields are automatically extracted by splunk witihout any issues. But last 2 fields since they are starting with # symbol didnt get extracted correctly. How can i extract them ? &lt;BR /&gt;
EmpNo,EmpName,EmpTitle,Region,Country,# completed,#not completed&lt;/P&gt;

&lt;P&gt;12345,"Razal,Rafi",Lead Service Specialist,UK,United Kingdom,0,1&lt;/P&gt;

&lt;P&gt;My file contnt looks like above line. I surrounded them with double quotes thinking that it will be easy for extraction since i have comma in Name field along with comma as delimiter to look like below. &lt;/P&gt;

&lt;P&gt;"12345",""Razal,Rafi"","Lead Service Specialist","UK","United Kingdom","0","1"&lt;/P&gt;

&lt;P&gt;Please help me with rex for field extraction. to extract last two fields. &lt;/P&gt;</description>
      <pubDate>Thu, 05 Apr 2018 09:59:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/rex-to-extract-field-from-csv/m-p/314185#M94031</guid>
      <dc:creator>surekhasplunk</dc:creator>
      <dc:date>2018-04-05T09:59:46Z</dc:date>
    </item>
    <item>
      <title>Re: rex to extract field from csv</title>
      <link>https://community.splunk.com/t5/Splunk-Search/rex-to-extract-field-from-csv/m-p/314186#M94032</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;yoursearch |rex (?P&amp;lt;field1&amp;gt;\w+),(?P&amp;lt;field2&amp;gt;\w+),(?P&amp;lt;field3&amp;gt;\w+),(?P&amp;lt;field4&amp;gt;\w+),(?P&amp;lt;field5&amp;gt;\w+),(?P&amp;lt;field6&amp;gt;\#\s\w+),(?P&amp;lt;field7&amp;gt;\#\w+\s\w+)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 05 Apr 2018 10:15:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/rex-to-extract-field-from-csv/m-p/314186#M94032</guid>
      <dc:creator>splunker12er</dc:creator>
      <dc:date>2018-04-05T10:15:41Z</dc:date>
    </item>
    <item>
      <title>Re: rex to extract field from csv</title>
      <link>https://community.splunk.com/t5/Splunk-Search/rex-to-extract-field-from-csv/m-p/314187#M94033</link>
      <description>&lt;P&gt;Try this regex when other fields are not surrounded by double quotes:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;rex ",(?&amp;lt;completed&amp;gt;\d),(?&amp;lt;notCompleted&amp;gt;\d)$"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 05 Apr 2018 10:26:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/rex-to-extract-field-from-csv/m-p/314187#M94033</guid>
      <dc:creator>ips_mandar</dc:creator>
      <dc:date>2018-04-05T10:26:19Z</dc:date>
    </item>
    <item>
      <title>Re: rex to extract field from csv</title>
      <link>https://community.splunk.com/t5/Splunk-Search/rex-to-extract-field-from-csv/m-p/314188#M94034</link>
      <description>&lt;P&gt;Its not working giving me error at field2 as it has got comma inside the name i believe&lt;/P&gt;</description>
      <pubDate>Thu, 05 Apr 2018 11:52:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/rex-to-extract-field-from-csv/m-p/314188#M94034</guid>
      <dc:creator>surekhasplunk</dc:creator>
      <dc:date>2018-04-05T11:52:15Z</dc:date>
    </item>
    <item>
      <title>Re: rex to extract field from csv</title>
      <link>https://community.splunk.com/t5/Splunk-Search/rex-to-extract-field-from-csv/m-p/314189#M94035</link>
      <description>&lt;P&gt;Does all your data will have the same comma or only for this particular event?&lt;/P&gt;</description>
      <pubDate>Thu, 05 Apr 2018 11:56:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/rex-to-extract-field-from-csv/m-p/314189#M94035</guid>
      <dc:creator>splunker12er</dc:creator>
      <dc:date>2018-04-05T11:56:36Z</dc:date>
    </item>
    <item>
      <title>Re: rex to extract field from csv</title>
      <link>https://community.splunk.com/t5/Splunk-Search/rex-to-extract-field-from-csv/m-p/314190#M94036</link>
      <description>&lt;P&gt;only for that particular event .. As other events might have 2 commas or might not have comma at all. for that column&lt;BR /&gt;
Can we just ignore writing rex for those fields as splunk already extracts them well . its just that m more worried about the last 2 fields. &lt;/P&gt;</description>
      <pubDate>Thu, 05 Apr 2018 12:14:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/rex-to-extract-field-from-csv/m-p/314190#M94036</guid>
      <dc:creator>surekhasplunk</dc:creator>
      <dc:date>2018-04-05T12:14:45Z</dc:date>
    </item>
    <item>
      <title>Re: rex to extract field from csv</title>
      <link>https://community.splunk.com/t5/Splunk-Search/rex-to-extract-field-from-csv/m-p/314191#M94037</link>
      <description>&lt;P&gt;try this,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;yoursearch |rex '(?P&amp;lt;Emp_No&amp;gt;\d+),(?P&amp;lt;Emp_Name&amp;gt;\S+),(?P&amp;lt;Title&amp;gt;[\w|\s]+),(?P&amp;lt;Region&amp;gt;\w+),(?P&amp;lt;Country&amp;gt;[\w|\s]+),(?P&amp;lt;Completed&amp;gt;\d+),(?P&amp;lt;Not_Completed&amp;gt;\d+)' | table *
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 05 Apr 2018 12:21:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/rex-to-extract-field-from-csv/m-p/314191#M94037</guid>
      <dc:creator>splunker12er</dc:creator>
      <dc:date>2018-04-05T12:21:50Z</dc:date>
    </item>
    <item>
      <title>Re: rex to extract field from csv</title>
      <link>https://community.splunk.com/t5/Splunk-Search/rex-to-extract-field-from-csv/m-p/314192#M94038</link>
      <description>&lt;P&gt;i saved the results here - you can verify below&lt;/P&gt;

&lt;P&gt;&lt;A href="https://regex101.com/r/ZenZiK/1"&gt;https://regex101.com/r/ZenZiK/1&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Apr 2018 12:23:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/rex-to-extract-field-from-csv/m-p/314192#M94038</guid>
      <dc:creator>splunker12er</dc:creator>
      <dc:date>2018-04-05T12:23:52Z</dc:date>
    </item>
    <item>
      <title>Re: rex to extract field from csv</title>
      <link>https://community.splunk.com/t5/Splunk-Search/rex-to-extract-field-from-csv/m-p/314193#M94039</link>
      <description>&lt;P&gt;if this help, please vote/ mark as answered//...&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;
thanks&lt;/P&gt;</description>
      <pubDate>Thu, 05 Apr 2018 12:25:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/rex-to-extract-field-from-csv/m-p/314193#M94039</guid>
      <dc:creator>splunker12er</dc:creator>
      <dc:date>2018-04-05T12:25:05Z</dc:date>
    </item>
    <item>
      <title>Re: rex to extract field from csv</title>
      <link>https://community.splunk.com/t5/Splunk-Search/rex-to-extract-field-from-csv/m-p/314194#M94040</link>
      <description>&lt;P&gt;Could you please provide raw event to generate the Regex&lt;/P&gt;</description>
      <pubDate>Thu, 05 Apr 2018 12:36:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/rex-to-extract-field-from-csv/m-p/314194#M94040</guid>
      <dc:creator>logloganathan</dc:creator>
      <dc:date>2018-04-05T12:36:09Z</dc:date>
    </item>
    <item>
      <title>Re: rex to extract field from csv</title>
      <link>https://community.splunk.com/t5/Splunk-Search/rex-to-extract-field-from-csv/m-p/314195#M94041</link>
      <description>&lt;P&gt;Thanks you very much @splunker12er and ips_mandar. I just tweaked a little and it worked like magic. i used $ to get the last field and rest like (?P\d) to get the fields. &lt;/P&gt;</description>
      <pubDate>Mon, 09 Apr 2018 07:44:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/rex-to-extract-field-from-csv/m-p/314195#M94041</guid>
      <dc:creator>surekhasplunk</dc:creator>
      <dc:date>2018-04-09T07:44:37Z</dc:date>
    </item>
  </channel>
</rss>

