<?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: Replacing carriage return with special character in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Replacing-carriage-return-with-special-character/m-p/259076#M176099</link>
    <description>&lt;P&gt;Can you add a screenshot of your Computer field. Seems like you have a multi-valued field where you can use all the even indexes for Computer and odd indexes for IP Addresses i.e. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;eval Computer1=mvindex(Computer,0) | eval IPAddress1=mvindex(Computer,1) | eval Computer1=mvindex(Computer,2) | eval IPAddress1=mvindex(Computer,3) | ... 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Please let me know whether you want to do something like above, then you can use foreach to iterate through your records. &lt;/P&gt;

&lt;P&gt;Also if the field is formed as multi-valued by your search query, you can also try to see if there is a feasibility to split them upfront rather than using mv commands.&lt;/P&gt;</description>
    <pubDate>Wed, 07 Dec 2016 04:11:52 GMT</pubDate>
    <dc:creator>niketn</dc:creator>
    <dc:date>2016-12-07T04:11:52Z</dc:date>
    <item>
      <title>Replacing carriage return with special character</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Replacing-carriage-return-with-special-character/m-p/259070#M176093</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Results of a search returns computer name and IPaddress separated by a carriage return&lt;/P&gt;

&lt;P&gt;ComputerName  [carriage return]  ip Adress&lt;/P&gt;

&lt;P&gt;I would like to separate them into 2 separate fields&lt;/P&gt;

&lt;P&gt;Computername  Ipaddresss&lt;/P&gt;

&lt;P&gt;OR&lt;/P&gt;

&lt;P&gt;Replace &lt;/P&gt;</description>
      <pubDate>Wed, 30 Nov 2016 23:34:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Replacing-carriage-return-with-special-character/m-p/259070#M176093</guid>
      <dc:creator>ajdyer2000</dc:creator>
      <dc:date>2016-11-30T23:34:27Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing carriage return with special character</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Replacing-carriage-return-with-special-character/m-p/259071#M176094</link>
      <description>&lt;P&gt;Can you please paste the exact events?&lt;/P&gt;</description>
      <pubDate>Thu, 01 Dec 2016 00:41:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Replacing-carriage-return-with-special-character/m-p/259071#M176094</guid>
      <dc:creator>gokadroid</dc:creator>
      <dc:date>2016-12-01T00:41:50Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing carriage return with special character</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Replacing-carriage-return-with-special-character/m-p/259072#M176095</link>
      <description>&lt;P&gt;Try this, assuming the field is called &lt;CODE&gt;src&lt;/CODE&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex field=src "(?&amp;lt;ComputerName&amp;gt;[^\n]+)\n(?&amp;lt;IP&amp;gt;.*)" | table ComputerName IP
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 01 Dec 2016 01:53:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Replacing-carriage-return-with-special-character/m-p/259072#M176095</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-12-01T01:53:18Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing carriage return with special character</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Replacing-carriage-return-with-special-character/m-p/259073#M176096</link>
      <description>&lt;P&gt;Assuming &lt;STRONG&gt;Field&lt;/STRONG&gt; is the field extracted by your search which contains both ComputerName and IPAddress values separated by newline character. You can use replace command to add your own delimeter (in the following example \n is replaced with #. Finally you can use split and mvindex command to read the two fields as needed.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;Your base Search&amp;gt; | eval Field= replace (Field,"\n","#") | eval Fields=split(Field,"#")| eval ComputerName=mvindex(Fields,0) | eval IPAddress=mvindex(Fields,1) | table Field ComputerName IPAddress
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 01 Dec 2016 03:35:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Replacing-carriage-return-with-special-character/m-p/259073#M176096</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2016-12-01T03:35:33Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing carriage return with special character</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Replacing-carriage-return-with-special-character/m-p/259074#M176097</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I don't think I explained it the right way&lt;/P&gt;

&lt;P&gt;I only have one field = Computer &lt;/P&gt;

&lt;P&gt;Under Computer I have computer names and IP addresses&lt;/P&gt;

&lt;P&gt;Computer1 [Carriage Return] 172.34.102.11&lt;BR /&gt;
Computer2 [Carriage Return] 172.34.102.33&lt;BR /&gt;
Computer3 [Carriage Return] 172.34.102.45&lt;BR /&gt;
Computer4 [Carriage Return] 172.34.102.78&lt;BR /&gt;
Computer5 [Carriage Return] 172.34.102.90&lt;/P&gt;

&lt;P&gt;Need to create another field Called IP addresses&lt;/P&gt;

&lt;P&gt;So now there will be 2 fields &lt;/P&gt;

&lt;P&gt;Computer    IPAddress&lt;/P&gt;

&lt;P&gt;Computer1   172.34.102.11&lt;BR /&gt;
Computer2   172.34.102.33&lt;BR /&gt;
Computer3   172.34.102.45&lt;BR /&gt;
Computer4   172.34.102.78&lt;BR /&gt;
Computer5   172.34.102.90&lt;/P&gt;

&lt;P&gt;So now there will be 2 fields &lt;BR /&gt;
Computer &lt;/P&gt;</description>
      <pubDate>Thu, 01 Dec 2016 15:05:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Replacing-carriage-return-with-special-character/m-p/259074#M176097</guid>
      <dc:creator>ajdyer2000</dc:creator>
      <dc:date>2016-12-01T15:05:44Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing carriage return with special character</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Replacing-carriage-return-with-special-character/m-p/259075#M176098</link>
      <description>&lt;P&gt;Hi @ajdyer200 - I received a notification that you accepted sundareshr's answer but here it is unaccepted. Did you accidentally unaccept the answer? Or did the answer not provide the solution you were looking for? If it's the latter, please leave a comment for sundareshr for additional feedback.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Dec 2016 23:40:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Replacing-carriage-return-with-special-character/m-p/259075#M176098</guid>
      <dc:creator>aaraneta_splunk</dc:creator>
      <dc:date>2016-12-06T23:40:06Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing carriage return with special character</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Replacing-carriage-return-with-special-character/m-p/259076#M176099</link>
      <description>&lt;P&gt;Can you add a screenshot of your Computer field. Seems like you have a multi-valued field where you can use all the even indexes for Computer and odd indexes for IP Addresses i.e. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;eval Computer1=mvindex(Computer,0) | eval IPAddress1=mvindex(Computer,1) | eval Computer1=mvindex(Computer,2) | eval IPAddress1=mvindex(Computer,3) | ... 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Please let me know whether you want to do something like above, then you can use foreach to iterate through your records. &lt;/P&gt;

&lt;P&gt;Also if the field is formed as multi-valued by your search query, you can also try to see if there is a feasibility to split them upfront rather than using mv commands.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Dec 2016 04:11:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Replacing-carriage-return-with-special-character/m-p/259076#M176099</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2016-12-07T04:11:52Z</dc:date>
    </item>
  </channel>
</rss>

