<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Forex Software — Problem with AWK converter script]]></title>
		<link>https://forexsb.com/forum/topic/940/problem-with-awk-converter-script/</link>
		<atom:link href="https://forexsb.com/forum/feed/rss/topic/940/" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Problem with AWK converter script.]]></description>
		<lastBuildDate>Mon, 22 Jun 2009 18:22:35 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Problem with AWK converter script]]></title>
			<link>https://forexsb.com/forum/post/2677/#p2677</link>
			<description><![CDATA[<p>Hello, <br />I have some problem with data conversion, my data are received in the template like below (input.csv):<br /><em>(ticker,periodicity,date,hour,popen,phigh,plow,pclose,volume)<br />FW20U09_I,1,20090619,083300,1928.00,1928.00,1927.00,1927.00,44<br />FW20U09_I,1,20090619,083400,1927.00,1929.00,1926.00,1928.00,48<br />FW20U09_I,1,20090619,083600,1926.00,1928.00,1926.00,1928.00,43<br />FW20U09_I,1,20090619,083900,1929.00,1930.00,1929.00,1930.00,76<br />FW20U09_I,1,20090619,084000,1929.00,1930.00,1929.00,1929.00,198</em></p><p>To convert this data I prepared file script.txt:</p><p><em># AWK script<br />{<br />&nbsp; &nbsp; # Check the number of the columns<br />&nbsp; &nbsp; # We need of 9 columns<br />&nbsp; &nbsp; if(NF == 9)<br />&nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; # Input file<br />&nbsp; &nbsp; &nbsp; &nbsp; # -----------------<br />&nbsp; &nbsp; &nbsp; &nbsp; ticker&nbsp; = $1;<br />&nbsp; &nbsp; &nbsp; &nbsp; period&nbsp; = $2;<br />&nbsp; &nbsp; &nbsp; &nbsp; date&nbsp; &nbsp; = $3;<br />&nbsp; &nbsp; &nbsp; &nbsp; time&nbsp; &nbsp; = $4;<br />&nbsp; &nbsp; &nbsp; &nbsp; popen&nbsp; &nbsp;= $5;<br />&nbsp; &nbsp; &nbsp; &nbsp; phigh&nbsp; &nbsp;= $6;<br />&nbsp; &nbsp; &nbsp; &nbsp; plow&nbsp; &nbsp; = $7;<br />&nbsp; &nbsp; &nbsp; &nbsp; pclose&nbsp; = $8;<br />&nbsp; &nbsp; &nbsp; &nbsp; volume&nbsp; = $9;<br />&nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; &nbsp; # Convert the Date format from YYYYMMDD to YYYY-MM-DD<br />&nbsp; &nbsp; &nbsp; &nbsp; year&nbsp; = substr(date,1,4);<br />&nbsp; &nbsp; &nbsp; &nbsp; month = substr(date,5,2);<br />&nbsp; &nbsp; &nbsp; &nbsp; day&nbsp; &nbsp;= substr(date,7,2);<br />&nbsp; &nbsp; &nbsp; &nbsp; date = year &quot;-&quot; month &quot;-&quot; day;</em></p><p><em>&nbsp; &nbsp; &nbsp; &nbsp; # Converts the Time from HHMMSS to HH:MM<br />&nbsp; &nbsp; &nbsp; &nbsp; if(length(time) = 6)<br />&nbsp; &nbsp; &nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hour = substr(time,1,2);<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; min = substr(3,2);<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; time = hour &quot;:&quot; min;<br />&nbsp; &nbsp; &nbsp; &nbsp; }<br />&nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; &nbsp; # Output file<br />&nbsp; &nbsp; &nbsp; &nbsp; # ------------------<br />&nbsp; &nbsp; &nbsp; &nbsp; print date &quot;;&quot; time &quot;;&quot; popen &quot;;&quot; phigh &quot;;&quot; plow &quot;;&quot; pclose &quot;;&quot; volume;<br />&nbsp; &nbsp; }<br />}</em></p><p>But I received empty output.csv file(0 bytes), where could be a problem?<br />Regards,</p>]]></description>
			<author><![CDATA[null@example.com (artuab)]]></author>
			<pubDate>Mon, 22 Jun 2009 18:22:35 +0000</pubDate>
			<guid>https://forexsb.com/forum/post/2677/#p2677</guid>
		</item>
	</channel>
</rss>
