<?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: perl + csv in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-csv/m-p/4793436#M641302</link>
    <description>sed -i s/'^M'/""/ test.csv&lt;BR /&gt;&lt;BR /&gt;Sorted :)</description>
    <pubDate>Mon, 30 May 2011 19:25:06 GMT</pubDate>
    <dc:creator>Piotr Kirklewski</dc:creator>
    <dc:date>2011-05-30T19:25:06Z</dc:date>
    <item>
      <title>perl + csv</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-csv/m-p/4793426#M641292</link>
      <description>Hi there&lt;BR /&gt;How do I operate on collumns rather then lines in csv file from perl ?&lt;BR /&gt;I have two csv files each having a number of columns. The goal is to combine them together in a third file by concatenation.&lt;BR /&gt;&lt;BR /&gt;File1 ColA,ColB&lt;BR /&gt;File2 ColC,ColD&lt;BR /&gt;File3 ColA,ColB,ColC,ColD&lt;BR /&gt;&lt;BR /&gt;Thanks</description>
      <pubDate>Mon, 30 May 2011 11:53:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-csv/m-p/4793426#M641292</guid>
      <dc:creator>Piotr Kirklewski</dc:creator>
      <dc:date>2011-05-30T11:53:33Z</dc:date>
    </item>
    <item>
      <title>Re: perl + csv</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-csv/m-p/4793427#M641293</link>
      <description>I assume you need to read both files in parallel and then write the columns from File1 then a comma then the columns in File2.&lt;BR /&gt;&lt;BR /&gt;Or use: paste -d, File1 File2 &amp;gt; File3</description>
      <pubDate>Mon, 30 May 2011 12:25:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-csv/m-p/4793427#M641293</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2011-05-30T12:25:33Z</dc:date>
    </item>
    <item>
      <title>Re: perl + csv</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-csv/m-p/4793428#M641294</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;If you are serious about operating on CSV files, you should use a module that handles the nuances well.  One such module is:&lt;BR /&gt;&lt;BR /&gt;Text::CSV_XS&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://search.cpan.org/~hmbrand/Text-CSV_XS-0.82/" target="_blank"&gt;http://search.cpan.org/~hmbrand/Text-CSV_XS-0.82/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;As a general response to your question, 'split' divides a sting of characters into elements (fields) of an array based on the regular expression you define as its delimiter. Using 'join' is one way to compose a new string with a new separator from an array. &lt;BR /&gt;&lt;BR /&gt;If, as your example suggests your task is as simple as shown, you could simply use 'paste' to join the line of the two files into a third.&lt;BR /&gt;&lt;BR /&gt;As usual, I urge you to *read* the manpages and the Perl documentation for the aforementioned commands. TMTOWTDI.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Mon, 30 May 2011 12:30:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-csv/m-p/4793428#M641294</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2011-05-30T12:30:22Z</dc:date>
    </item>
    <item>
      <title>Re: perl + csv</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-csv/m-p/4793429#M641295</link>
      <description>Hi (again) Piotr:&lt;BR /&gt;&lt;BR /&gt;So what hasn't satisfied your question?  &lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Mon, 30 May 2011 12:49:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-csv/m-p/4793429#M641295</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2011-05-30T12:49:42Z</dc:date>
    </item>
    <item>
      <title>Re: perl + csv</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-csv/m-p/4793430#M641296</link>
      <description>The files look something like this:&lt;BR /&gt;&lt;BR /&gt;ColA ColB &lt;BR /&gt;val1 val1&lt;BR /&gt;val2 val2&lt;BR /&gt;val3 val3&lt;BR /&gt;&lt;BR /&gt;ColC ColD &lt;BR /&gt;val1 val1&lt;BR /&gt;val2 val2&lt;BR /&gt;val3 val3&lt;BR /&gt;&lt;BR /&gt;ColA ColB ColC ColD &lt;BR /&gt;val1 val1 val1 val1&lt;BR /&gt;val2 val2 val2 val2 &lt;BR /&gt;val3 val3 val3 val3&lt;BR /&gt;...&lt;BR /&gt;&lt;BR /&gt;I tried "paste -d" but i think it operates on rows rather than columns. The output file was a complete mess.&lt;BR /&gt;&lt;BR /&gt;Will try to use perl instead.&lt;BR /&gt;</description>
      <pubDate>Mon, 30 May 2011 12:55:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-csv/m-p/4793430#M641296</guid>
      <dc:creator>Piotr Kirklewski</dc:creator>
      <dc:date>2011-05-30T12:55:19Z</dc:date>
    </item>
    <item>
      <title>Re: perl + csv</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-csv/m-p/4793431#M641297</link>
      <description>&amp;gt;I tried "paste -d" but I think it operates on rows rather than columns. The output file was a complete mess.&lt;BR /&gt;&lt;BR /&gt;Yes, paste(1) operates on lines.  But in your case, you want to use all of the columns in a line and just concatenate them.&lt;BR /&gt;You might want to show the "complete mess".&lt;BR /&gt;Or use paste on your above simple example to see how it works.</description>
      <pubDate>Mon, 30 May 2011 13:03:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-csv/m-p/4793431#M641297</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2011-05-30T13:03:43Z</dc:date>
    </item>
    <item>
      <title>Re: perl + csv</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-csv/m-p/4793432#M641298</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;I tried "paste -d" but i think it operates on rows rather than columns. The output file was a complete mess.&lt;BR /&gt;&lt;BR /&gt;Define "mess".  What command syntax did you actually use?  By default, a tab character is used for the field delimiter.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Mon, 30 May 2011 13:13:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-csv/m-p/4793432#M641298</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2011-05-30T13:13:40Z</dc:date>
    </item>
    <item>
      <title>Re: perl + csv</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-csv/m-p/4793433#M641299</link>
      <description>install, if not already installed, Spreadsheet::Read&lt;BR /&gt;&lt;BR /&gt;It will use Text::CSV_XS to parse the CSV file/data and present you with a column-interface&lt;BR /&gt;&lt;BR /&gt;Enjoy, Have FUN! H.Merijn</description>
      <pubDate>Mon, 30 May 2011 13:14:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-csv/m-p/4793433#M641299</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2011-05-30T13:14:27Z</dc:date>
    </item>
    <item>
      <title>Re: perl + csv</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-csv/m-p/4793434#M641300</link>
      <description>FWIW, this awfully looks like &lt;A href="http://www.perlmonks.org/?node_id=901226" target="_blank"&gt;http://www.perlmonks.org/?node_id=901226&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Read more there, though that also did not lead to a definite conclusion&lt;BR /&gt;&lt;BR /&gt;Enjoy, Have FUN! H.Merijn</description>
      <pubDate>Mon, 30 May 2011 13:46:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-csv/m-p/4793434#M641300</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2011-05-30T13:46:25Z</dc:date>
    </item>
    <item>
      <title>Re: perl + csv</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-csv/m-p/4793435#M641301</link>
      <description>Maybe paste is not that bad but it inserts ^M after the last column of the first file and before the first column of the second file:&lt;BR /&gt;This meses the format:&lt;BR /&gt;&lt;BR /&gt;,Stopped (F),Stopped (F)^M,,2011-05-30-09:24:34.963,20,0,0,&lt;BR /&gt;&lt;BR /&gt;:%s /^M/ /g fixes it from within the vim but the problem is I want to clean ^M from my script automatically.&lt;BR /&gt;&lt;BR /&gt;Sed doesn't work:&lt;BR /&gt;&lt;BR /&gt;sed -i s/"^M"/""/ test.csv  &lt;BR /&gt;&lt;BR /&gt;Please &lt;BR /&gt;&lt;BR /&gt;Help&lt;BR /&gt;</description>
      <pubDate>Mon, 30 May 2011 19:02:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-csv/m-p/4793435#M641301</guid>
      <dc:creator>Piotr Kirklewski</dc:creator>
      <dc:date>2011-05-30T19:02:09Z</dc:date>
    </item>
    <item>
      <title>Re: perl + csv</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-csv/m-p/4793436#M641302</link>
      <description>sed -i s/'^M'/""/ test.csv&lt;BR /&gt;&lt;BR /&gt;Sorted :)</description>
      <pubDate>Mon, 30 May 2011 19:25:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-csv/m-p/4793436#M641302</guid>
      <dc:creator>Piotr Kirklewski</dc:creator>
      <dc:date>2011-05-30T19:25:06Z</dc:date>
    </item>
    <item>
      <title>Re: perl + csv</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-csv/m-p/4793437#M641303</link>
      <description>If i put this line in the script:&lt;BR /&gt;&lt;BR /&gt;/bin/sed -i s/'^M'/""/ /home/peter/test/"0041"$TODAY".csv"&lt;BR /&gt;&lt;BR /&gt;It gets interpreted as:&lt;BR /&gt;&lt;BR /&gt;/bin/sed -i 's/^M//' /home/peter/test/004120110530.csv&lt;BR /&gt;&lt;BR /&gt;And it doesn't remove the ^M from the file.&lt;BR /&gt;&lt;BR /&gt;How to fix this ?&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 30 May 2011 19:54:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-csv/m-p/4793437#M641303</guid>
      <dc:creator>Piotr Kirklewski</dc:creator>
      <dc:date>2011-05-30T19:54:36Z</dc:date>
    </item>
    <item>
      <title>Re: perl + csv</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-csv/m-p/4793438#M641304</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;&amp;gt; Maybe paste is not that bad but it inserts ^M after the last column of the first file and before the first column of the second file:&lt;BR /&gt;&lt;BR /&gt;Then your file contained the carriage return in the first place.  'paste' uses a tab character as its default unless you override it with '-d &lt;CHAR_LIST&gt;.&lt;BR /&gt;&lt;BR /&gt;Since you asked about Perl, you could remove the nasty carriage-returns with:&lt;BR /&gt;&lt;BR /&gt;# perl -pi -e 's{\r$}{}' file&lt;BR /&gt;&lt;BR /&gt;...which will do an in-place update of 'file' ridding it of the pesky carriage-returns.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;/CHAR_LIST&gt;</description>
      <pubDate>Mon, 30 May 2011 19:57:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-csv/m-p/4793438#M641304</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2011-05-30T19:57:01Z</dc:date>
    </item>
    <item>
      <title>Re: perl + csv</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-csv/m-p/4793439#M641305</link>
      <description>&amp;gt;It gets interpreted as:&lt;BR /&gt;&lt;BR /&gt;Are you using control-V control-M to insert the CR into the string?&lt;BR /&gt;sed -i -e 's/^V^M//' 004120110530.csv&lt;BR /&gt;&lt;BR /&gt;Otherwise you can use echo:&lt;BR /&gt;sed -i -e 's/$(echo "\r\c")//' 004120110530.csv</description>
      <pubDate>Mon, 30 May 2011 21:15:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-csv/m-p/4793439#M641305</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2011-05-30T21:15:14Z</dc:date>
    </item>
  </channel>
</rss>

