<?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 Can I define fields like in AWK, basically define extract field without using regex. in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Can-I-define-fields-like-in-AWK-basically-define-extract-field/m-p/13110#M1157</link>
    <description>&lt;P&gt;Let's say we want to process the typical data input like below :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;12|Jones Indiana|76|223-33-3323|US|CALIFORNIA|MARRIED
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In splunk, I have to use "rex"  and do a whole bunch of regex to parse out the fields.
Is there a way in Splunk to process these kind of structured log like in awk manner?&lt;/P&gt;

&lt;P&gt;awk manner, meaning   &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;awk -F"|" '{print $1" "$2" "$3}'  and so on...
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In another words define pattern for delimiter which is  "|" and just assign values with field number like $1, $2&lt;/P&gt;

&lt;P&gt;I thought powerful engine like splunk would have a similar way to process.  Field parsing without doing while bunch of regex.&lt;/P&gt;

&lt;P&gt;YhC.&lt;/P&gt;</description>
    <pubDate>Fri, 07 May 2010 23:23:02 GMT</pubDate>
    <dc:creator>clyde772</dc:creator>
    <dc:date>2010-05-07T23:23:02Z</dc:date>
    <item>
      <title>Can I define fields like in AWK, basically define extract field without using regex.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-define-fields-like-in-AWK-basically-define-extract-field/m-p/13110#M1157</link>
      <description>&lt;P&gt;Let's say we want to process the typical data input like below :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;12|Jones Indiana|76|223-33-3323|US|CALIFORNIA|MARRIED
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In splunk, I have to use "rex"  and do a whole bunch of regex to parse out the fields.
Is there a way in Splunk to process these kind of structured log like in awk manner?&lt;/P&gt;

&lt;P&gt;awk manner, meaning   &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;awk -F"|" '{print $1" "$2" "$3}'  and so on...
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In another words define pattern for delimiter which is  "|" and just assign values with field number like $1, $2&lt;/P&gt;

&lt;P&gt;I thought powerful engine like splunk would have a similar way to process.  Field parsing without doing while bunch of regex.&lt;/P&gt;

&lt;P&gt;YhC.&lt;/P&gt;</description>
      <pubDate>Fri, 07 May 2010 23:23:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-define-fields-like-in-AWK-basically-define-extract-field/m-p/13110#M1157</guid>
      <dc:creator>clyde772</dc:creator>
      <dc:date>2010-05-07T23:23:02Z</dc:date>
    </item>
    <item>
      <title>Re: Can I define fields like in AWK, basically define extract field without using regex.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-define-fields-like-in-AWK-basically-define-extract-field/m-p/13111#M1158</link>
      <description>&lt;P&gt;You can use the DELIMS parameter to extract fields in that manner.  For example, we use the following for csv files:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[extract_csv]
DELIMS = ","
FIELDS = "field1", "field2", "field3"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;To correctly extract the fields in this manner, you should review the following page which details how to configure complex extractions through configuration files:&lt;/P&gt;

&lt;P&gt;&lt;A href="http://www.splunk.com/base/Documentation/latest/Knowledge/Createandmaintainsearch-timefieldextractionsthroughconfigurationfiles" rel="nofollow"&gt;http://www.splunk.com/base/Documentation/latest/Knowledge/Createandmaintainsearch-timefieldextractionsthroughconfigurationfiles&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 07 May 2010 23:31:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-define-fields-like-in-AWK-basically-define-extract-field/m-p/13111#M1158</guid>
      <dc:creator>Simeon</dc:creator>
      <dc:date>2010-05-07T23:31:31Z</dc:date>
    </item>
    <item>
      <title>Re: Can I define fields like in AWK, basically define extract field without using regex.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-define-fields-like-in-AWK-basically-define-extract-field/m-p/13112#M1159</link>
      <description>&lt;P&gt;You could also use the | extract command at search time. It takes a delims parameter.&lt;/P&gt;</description>
      <pubDate>Sat, 08 May 2010 06:23:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-define-fields-like-in-AWK-basically-define-extract-field/m-p/13112#M1159</guid>
      <dc:creator>Dan</dc:creator>
      <dc:date>2010-05-08T06:23:06Z</dc:date>
    </item>
    <item>
      <title>Re: Can I define fields like in AWK, basically define extract field without using regex.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-define-fields-like-in-AWK-basically-define-extract-field/m-p/13113#M1160</link>
      <description>&lt;P&gt;This is sometimes useful, but the &lt;CODE&gt;extract&lt;/CODE&gt; command's &lt;CODE&gt;delims&lt;/CODE&gt; is actually a pair &lt;CODE&gt;pairdelim&lt;/CODE&gt; and &lt;CODE&gt;kvdelim&lt;/CODE&gt; which are both required. Splunk doesn't generate sequential names like this.&lt;/P&gt;</description>
      <pubDate>Mon, 10 May 2010 12:33:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-define-fields-like-in-AWK-basically-define-extract-field/m-p/13113#M1160</guid>
      <dc:creator>gkanapathy</dc:creator>
      <dc:date>2010-05-10T12:33:24Z</dc:date>
    </item>
    <item>
      <title>Re: Can I define fields like in AWK, basically define extract field without using regex.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-define-fields-like-in-AWK-basically-define-extract-field/m-p/13114#M1161</link>
      <description>&lt;P&gt;This has very little to do with power, and more to do with clarity. While it's undoubtedly convenient to be able to throw down one-line expressions, the intention with Splunk is usually to define and name fields meaningfully for shared and long-term re-use.&lt;/P&gt;</description>
      <pubDate>Mon, 10 May 2010 12:34:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-define-fields-like-in-AWK-basically-define-extract-field/m-p/13114#M1161</guid>
      <dc:creator>gkanapathy</dc:creator>
      <dc:date>2010-05-10T12:34:42Z</dc:date>
    </item>
  </channel>
</rss>

