<?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: FTP a file in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/ftp-a-file/m-p/4069548#M307328</link>
    <description>Hey Hein&lt;BR /&gt;&lt;BR /&gt;the parameter of bcp&lt;BR /&gt;-t "&lt;EC&gt;" -r "&lt;ER&gt;"\n&lt;BR /&gt;&lt;BR /&gt;I'm trying to load these files (2000) with sqlloader in an oracle db. and it works also for each row except for the first because this characters.&lt;BR /&gt;&lt;BR /&gt;so I will load each file with sqlloader and after that I write the first line of each file to another file and remove this characters. after that I load this new file.&lt;BR /&gt;&lt;BR /&gt;The problem is, that I can't edit a 20Gb file for example with vi. &lt;BR /&gt;&lt;BR /&gt;what is the best way to redirect the first line of a file to an other file?&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;/ER&gt;&lt;/EC&gt;</description>
    <pubDate>Thu, 13 Sep 2007 03:11:56 GMT</pubDate>
    <dc:creator>Oviwan</dc:creator>
    <dc:date>2007-09-13T03:11:56Z</dc:date>
    <item>
      <title>FTP a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ftp-a-file/m-p/4069543#M307323</link>
      <description>Hey Folks&lt;BR /&gt;&lt;BR /&gt;We have a file on windows with this content:&lt;BR /&gt;F00092    &lt;EC&gt;2132.0&lt;ER&gt;F03B.....&lt;BR /&gt;&lt;BR /&gt;we created this file with bcp of ms sql with this parameter DATAFILETYPE = 'widechar' because the ö,ä,ü etc...&lt;BR /&gt;&lt;BR /&gt;If we ftp it to our HPUX box we get the following:&lt;BR /&gt;ascii or bin mode:&lt;BR /&gt;ÿþF00092    &lt;EC&gt;2132.0&lt;ER&gt;F.....&lt;BR /&gt;&lt;BR /&gt;is there a way to remove these first two character "ÿþ" from this file? if I copy this characters to the shell I get this "^?~"&lt;BR /&gt;&lt;BR /&gt;the size of the files are 20GB to 90GB. with vi we get Line too long...&lt;BR /&gt;&lt;BR /&gt;other thing I tried:&lt;BR /&gt;copy the file then&lt;BR /&gt;dd if=/tmp/file1 of=/tmp/file2 bs=1 skip=2&lt;BR /&gt;to skip the first two bytes but this takes too long ~300MB/30min.&lt;BR /&gt;&lt;BR /&gt;has anyone a fast way to do this?&lt;BR /&gt;&lt;BR /&gt;Thanks in advance&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;&lt;/ER&gt;&lt;/EC&gt;&lt;/ER&gt;&lt;/EC&gt;</description>
      <pubDate>Wed, 12 Sep 2007 11:03:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ftp-a-file/m-p/4069543#M307323</guid>
      <dc:creator>Oviwan</dc:creator>
      <dc:date>2007-09-12T11:03:10Z</dc:date>
    </item>
    <item>
      <title>Re: FTP a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ftp-a-file/m-p/4069544#M307324</link>
      <description>zip the file first on Windoze...then ftp as bin....&lt;BR /&gt;&lt;BR /&gt;Rgds...Geoff</description>
      <pubDate>Wed, 12 Sep 2007 11:08:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ftp-a-file/m-p/4069544#M307324</guid>
      <dc:creator>Geoff Wild</dc:creator>
      <dc:date>2007-09-12T11:08:25Z</dc:date>
    </item>
    <item>
      <title>Re: FTP a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ftp-a-file/m-p/4069545#M307325</link>
      <description>&amp;gt; the size of the files are 20GB to 90GB.&lt;BR /&gt;&lt;BR /&gt;&amp;gt; zip the file first on Windoze...then ftp&lt;BR /&gt;&amp;gt; as bin....&lt;BR /&gt;&lt;BR /&gt;Released versions of Info-ZIP UnZip (5.52 is&lt;BR /&gt;current) can not cope with files bigger than&lt;BR /&gt;2GB.  Unreleased versions&lt;BR /&gt;&lt;BR /&gt;&lt;A href="ftp://ftp.info-zip.org/pub/infozip/beta/" target="_blank"&gt;ftp://ftp.info-zip.org/pub/infozip/beta/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;should do better, but it's not obvious to me&lt;BR /&gt;why Zip+UnZip would do any better than binary&lt;BR /&gt;FTP.&lt;BR /&gt;&lt;BR /&gt;If you really are using binary FTP, and those&lt;BR /&gt;bytes appear at the destination, then I'd&lt;BR /&gt;suspect that those bytes are there at the&lt;BR /&gt;source.  Do you have a low-level tool like a&lt;BR /&gt;UNIX "od" which you could use to see the real&lt;BR /&gt;data in the source file?&lt;BR /&gt;&lt;BR /&gt;If those bytes are really in the source file,&lt;BR /&gt;then there may be data other than the first&lt;BR /&gt;two bytes which will also cause problems.</description>
      <pubDate>Wed, 12 Sep 2007 15:09:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ftp-a-file/m-p/4069545#M307325</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2007-09-12T15:09:33Z</dc:date>
    </item>
    <item>
      <title>Re: FTP a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ftp-a-file/m-p/4069546#M307326</link>
      <description>bcp (bulk copy) accepts a slew of options.&lt;BR /&gt;&lt;BR /&gt;-w selects unicode characters, so that' 2 bytes per character. It that what you are ready to deal with?&lt;BR /&gt;&lt;BR /&gt;Form the bcp man page:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://msdn2.microsoft.com/en-us/library/ms188289.aspx" target="_blank"&gt;http://msdn2.microsoft.com/en-us/library/ms188289.aspx&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;"Unicode character format data files follow the conventions for Unicode files. The first two bytes of the file are hexadecimal numbers, 0xFFFE. These bytes serve as byte-order marks, specifying whether the high-order byte is stored first or last in the file."&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;It seems to me that those 'funny' characters are supposed to be there for a proper Unicode file usage.&lt;BR /&gt;&lt;BR /&gt;What do yo intent to do with the file once on HPUX? &lt;BR /&gt;&lt;BR /&gt;If the hpux consuming program really can not deal with the MSB/LSB flag, then I suspect you want to look in the direction of Perl or a C program for a solution.&lt;BR /&gt;Perl support Unicode, but also supports 'binmode'.&lt;BR /&gt;&lt;BR /&gt;With binmode you could read the file in say 2048 or 512 byte chunks and stagger the output by 2 bytes as needed, much like dd, but using larger steps through the data.&lt;BR /&gt;&lt;BR /&gt;What record length is expected?&lt;BR /&gt;What record terminator expected? &lt;BR /&gt;What was the record select expression? All columns?&lt;BR /&gt;&lt;BR /&gt;By default bcp will deliver cr-lf (\r\n) line ends and tab (\t) column seperators.&lt;BR /&gt;&lt;BR /&gt;Be sure to do a $ od -x | head to get an impression of what is coming at you in detail.&lt;BR /&gt;&lt;BR /&gt;Hope this helps some,&lt;BR /&gt;Hein van den Heuvel (at gmail dot com)&lt;BR /&gt;HvdH Performance Consulting&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 12 Sep 2007 17:56:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ftp-a-file/m-p/4069546#M307326</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2007-09-12T17:56:09Z</dc:date>
    </item>
    <item>
      <title>Re: FTP a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ftp-a-file/m-p/4069547#M307327</link>
      <description>Oh and btw... when mucking with this kind of stuff, do yourself a favor and make a small test case first. &lt;BR /&gt;&lt;BR /&gt;As my teacher used to say... design allowing for your first solution to be thrown away... because you will.&lt;BR /&gt;&lt;BR /&gt;In your case that probably means to re-execute a bcp and on the SELECT add a LIMIT clause to say 1000. Now transfer and try.&lt;BR /&gt;So much more manageable!&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;Hein.&lt;BR /&gt;</description>
      <pubDate>Wed, 12 Sep 2007 18:01:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ftp-a-file/m-p/4069547#M307327</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2007-09-12T18:01:31Z</dc:date>
    </item>
    <item>
      <title>Re: FTP a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ftp-a-file/m-p/4069548#M307328</link>
      <description>Hey Hein&lt;BR /&gt;&lt;BR /&gt;the parameter of bcp&lt;BR /&gt;-t "&lt;EC&gt;" -r "&lt;ER&gt;"\n&lt;BR /&gt;&lt;BR /&gt;I'm trying to load these files (2000) with sqlloader in an oracle db. and it works also for each row except for the first because this characters.&lt;BR /&gt;&lt;BR /&gt;so I will load each file with sqlloader and after that I write the first line of each file to another file and remove this characters. after that I load this new file.&lt;BR /&gt;&lt;BR /&gt;The problem is, that I can't edit a 20Gb file for example with vi. &lt;BR /&gt;&lt;BR /&gt;what is the best way to redirect the first line of a file to an other file?&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;/ER&gt;&lt;/EC&gt;</description>
      <pubDate>Thu, 13 Sep 2007 03:11:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ftp-a-file/m-p/4069548#M307328</guid>
      <dc:creator>Oviwan</dc:creator>
      <dc:date>2007-09-13T03:11:56Z</dc:date>
    </item>
    <item>
      <title>Re: FTP a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ftp-a-file/m-p/4069549#M307329</link>
      <description>Is there a good, strong reason you used &lt;ER&gt; as record terminator (&lt;ENDRECORD&gt;) ?&lt;BR /&gt;That's why 'vi' fails!&lt;BR /&gt;Why not accept the default (\r\n) or specify just the unix standard newline (\n = linefeed )&lt;BR /&gt;&lt;BR /&gt;In perl you can specify the line terminator to be &lt;ER&gt;, but not in vi. So maybe this will work. (untested)&lt;BR /&gt;&lt;BR /&gt;perl -pe 'BEGIN {$/=} $_ = substr ($_,2)} old &amp;gt; new&lt;BR /&gt;&lt;BR /&gt;This might work on a small file but fail on a large one due to 'slurp'ing the file. If so, use read/sysread to stomp through the file in chunks, copying as you go.&lt;BR /&gt;&lt;BR /&gt;hth,&lt;BR /&gt;Hein.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/ER&gt;&lt;/ENDRECORD&gt;&lt;/ER&gt;</description>
      <pubDate>Thu, 13 Sep 2007 06:28:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ftp-a-file/m-p/4069549#M307329</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2007-09-13T06:28:48Z</dc:date>
    </item>
    <item>
      <title>Re: FTP a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ftp-a-file/m-p/4069550#M307330</link>
      <description>Hi Oviwan,&lt;BR /&gt;&lt;BR /&gt;have u tried using sed/head/cut etc&lt;BR /&gt;I am not sure if it works for &amp;gt; 20GB files , otherwise you have to use split command to split into multiple smaller size files.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; what is the best way to redirect the &amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; first line of a file to an other file?&lt;BR /&gt;&lt;BR /&gt;you can try this :&lt;BR /&gt;&lt;BR /&gt;### check if u have enough space&lt;BR /&gt;&lt;BR /&gt;head -1 file | cut -c 3- &amp;gt; file.line1&lt;BR /&gt;sed '1d' file &amp;gt; file.remaining&lt;BR /&gt;&lt;BR /&gt;you can use these files to load to the database.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;Rajdev&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 13 Sep 2007 06:31:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ftp-a-file/m-p/4069550#M307330</guid>
      <dc:creator>rajdev</dc:creator>
      <dc:date>2007-09-13T06:31:13Z</dc:date>
    </item>
    <item>
      <title>Re: FTP a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ftp-a-file/m-p/4069551#M307331</link>
      <description>More thoughts....&lt;BR /&gt;&lt;BR /&gt;Maybe you do want the \r\n dos default terminator to keep it a two-byte sequence. Just tell sqlloader?&lt;BR /&gt;&lt;BR /&gt;&amp;gt;&amp;gt;&amp;gt; and it works also for each row except for the first because this characters.&lt;BR /&gt;&lt;BR /&gt;if all but the first line is there, then why not fix the database entry for that first line?&lt;BR /&gt;&lt;BR /&gt;You could extract just enough to have the first record using for example : $dd -count=1 -bs=512 if=export of=tmp&lt;BR /&gt;Then edit this small file and sqlload the missing record?&lt;BR /&gt;&lt;BR /&gt;Hein.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 13 Sep 2007 06:35:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ftp-a-file/m-p/4069551#M307331</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2007-09-13T06:35:26Z</dc:date>
    </item>
    <item>
      <title>Re: FTP a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ftp-a-file/m-p/4069552#M307332</link>
      <description>what I'm trying to do is to migrate a ms sql db to oracle.&lt;BR /&gt;&lt;BR /&gt;I export the tables with bcp (with the -w parameter and -r "&lt;ER&gt;") of mssql to a *.dat file.&lt;BR /&gt;&lt;BR /&gt;and create the *.ctl files with the oracle migration workbench. the record separator is automatically  "&lt;ER&gt;". I could edit the files to change it, but this are over 2000 files...&lt;BR /&gt;&lt;BR /&gt;now I have the ctl and dat files for sqlloader.&lt;BR /&gt;&lt;BR /&gt;In the dat files are the two first bytes these ugly characters. so the sqlldr process fails... if I delete this chars with vi and do run sqlldr then the Ã¶ Ã¤ Ã¼ char converts to a Â¿ sign. when I open the dat file with vi i see Ã¶ Ã¤ Ã¼ .&lt;BR /&gt;&lt;BR /&gt;does someone have experience with this kind of migration?&lt;BR /&gt;&lt;BR /&gt;&lt;/ER&gt;&lt;/ER&gt;</description>
      <pubDate>Thu, 13 Sep 2007 08:51:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ftp-a-file/m-p/4069552#M307332</guid>
      <dc:creator>Oviwan</dc:creator>
      <dc:date>2007-09-13T08:51:23Z</dc:date>
    </item>
    <item>
      <title>Re: FTP a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ftp-a-file/m-p/4069553#M307333</link>
      <description>Ok now it works with Ã¶ Ã¤ Ã¼ (vowel mutation). I set&lt;BR /&gt;export NLS_LANG=AMERICAN_AMERICA.WE8MSWIN1252&lt;BR /&gt;&lt;BR /&gt;But the problem with the first two bytes still exists.&lt;BR /&gt;&lt;BR /&gt;I can redirect the first line to an other file:&lt;BR /&gt;# sed -n "1p" file1 &amp;gt;&amp;gt; file2&lt;BR /&gt;&lt;BR /&gt;But how can I delete the first line of a file and replace this line with nothing so that there is no blank line at the beginning of the file.&lt;BR /&gt;&lt;BR /&gt;Summary.&lt;BR /&gt;the second line become the first line...</description>
      <pubDate>Thu, 13 Sep 2007 11:33:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ftp-a-file/m-p/4069553#M307333</guid>
      <dc:creator>Oviwan</dc:creator>
      <dc:date>2007-09-13T11:33:44Z</dc:date>
    </item>
    <item>
      <title>Re: FTP a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ftp-a-file/m-p/4069554#M307334</link>
      <description>Well, if that first sed worked to get the first line, then the next sed might get the rest:&lt;BR /&gt;&lt;BR /&gt;$ sed -n '2,$p' all &amp;gt; all-but-one&lt;BR /&gt;&lt;BR /&gt;fwiw,&lt;BR /&gt;Hein.&lt;BR /&gt;</description>
      <pubDate>Thu, 13 Sep 2007 12:20:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ftp-a-file/m-p/4069554#M307334</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2007-09-13T12:20:47Z</dc:date>
    </item>
    <item>
      <title>Re: FTP a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ftp-a-file/m-p/4069555#M307335</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;answering to your last query :&lt;BR /&gt;&lt;BR /&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;But how can I delete the first line of a file and replace this line with nothing so that there is no blank line at the beginning of the file.&lt;BR /&gt;&lt;BR /&gt;Just do &lt;BR /&gt;&lt;BR /&gt;#sed '1d' file &amp;gt; file2&lt;BR /&gt;&lt;BR /&gt;Regards</description>
      <pubDate>Fri, 14 Sep 2007 00:21:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ftp-a-file/m-p/4069555#M307335</guid>
      <dc:creator>rajdev</dc:creator>
      <dc:date>2007-09-14T00:21:02Z</dc:date>
    </item>
    <item>
      <title>Re: FTP a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ftp-a-file/m-p/4069556#M307336</link>
      <description>It seems to work now, I tested it with a 10Gb file.&lt;BR /&gt;&lt;BR /&gt;instead of&lt;BR /&gt;dos2ux file1 &amp;gt; file2 #didn't works for huge files&lt;BR /&gt;used:&lt;BR /&gt;sed 's/^M$//' file1 &amp;gt; file2&lt;BR /&gt;&lt;BR /&gt;then for first line and rest:&lt;BR /&gt;sed -n '1p' file2 &amp;gt; first_line&lt;BR /&gt;sed '1d' &amp;gt; file2 &amp;gt; all&lt;BR /&gt;&lt;BR /&gt;And in the ctl file for sqlloader is set \r\n as record separator instead of \n&lt;BR /&gt;&lt;BR /&gt;thanks for helping me&lt;BR /&gt;&lt;BR /&gt;Regards</description>
      <pubDate>Fri, 14 Sep 2007 06:52:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ftp-a-file/m-p/4069556#M307336</guid>
      <dc:creator>Oviwan</dc:creator>
      <dc:date>2007-09-14T06:52:53Z</dc:date>
    </item>
  </channel>
</rss>

