<?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: strange redirection or piping problem in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/strange-redirection-or-piping-problem/m-p/4234579#M675876</link>
    <description>Shalom,&lt;BR /&gt;&lt;BR /&gt;Try and read and write to the same file at the same time, with say two separate processes.&lt;BR /&gt;&lt;BR /&gt;Have the write process put in legible english words.&lt;BR /&gt;&lt;BR /&gt;Think that's what the output is going to look like? No.&lt;BR /&gt;&lt;BR /&gt;The reason Unix shell does not permit read and write of the same file at the same time is to give you some chance of having a consistent, usable file at the end of the day.&lt;BR /&gt;&lt;BR /&gt;Accept this rule as fact and move on.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
    <pubDate>Thu, 17 Jul 2008 10:08:36 GMT</pubDate>
    <dc:creator>Steven E. Protter</dc:creator>
    <dc:date>2008-07-17T10:08:36Z</dc:date>
    <item>
      <title>strange redirection or piping problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/strange-redirection-or-piping-problem/m-p/4234574#M675866</link>
      <description>We have two different behaviors for two different HPUX servers: &lt;BR /&gt;&lt;BR /&gt;on DEV: &lt;BR /&gt;--------&lt;BR /&gt;dev@/home/user123&amp;gt; ll a.txt&lt;BR /&gt;-rw-r--r--   1 user123    users        16385 Jul 16 13:20 a.txt&lt;BR /&gt;dev@/home/user123&amp;gt;&lt;BR /&gt;dev@/home/user123&amp;gt; cat a.txt | sort &amp;gt; a.txt&lt;BR /&gt;sort: Warning: A newline character was added to the end of the input.&lt;BR /&gt;dev@/home/user123&amp;gt; ll a.txt&lt;BR /&gt;-rw-r--r--   1 user123    users        16385 Jul 16 13:20 a.txt&lt;BR /&gt;dev@/home/user123&amp;gt;&lt;BR /&gt;&lt;BR /&gt;on PROD:&lt;BR /&gt;--------&lt;BR /&gt;prod@/home/user123&amp;gt; ll a.txt&lt;BR /&gt;-rw-r--r--   1 user123    users        16385 Jul 16 13:20 a.txt&lt;BR /&gt;prod@/home/user123&amp;gt;&lt;BR /&gt;prod@/home/user123&amp;gt; cat a.txt | sort &amp;gt; a.txt&lt;BR /&gt;sort: Warning: A newline character was added to the end of the input.&lt;BR /&gt;prod@/home/user123&amp;gt; ll a.txt&lt;BR /&gt;-rw-r--r--   1 user123    users        0    Jul 16 13:20 a.txt&lt;BR /&gt;prod@/home/user123&amp;gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;As you can see on PROD the file became zero after the piping and redirection but not on DEV.&lt;BR /&gt;&lt;BR /&gt;Is that any shell parameter net to set? What is the normal/default behaviour?&lt;BR /&gt;&lt;BR /&gt;Thank you,&lt;BR /&gt;&lt;BR /&gt;Iwan Tamimi&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 16 Jul 2008 04:28:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/strange-redirection-or-piping-problem/m-p/4234574#M675866</guid>
      <dc:creator>irt_1</dc:creator>
      <dc:date>2008-07-16T04:28:41Z</dc:date>
    </item>
    <item>
      <title>Re: strange redirection or piping problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/strange-redirection-or-piping-problem/m-p/4234575#M675869</link>
      <description>&amp;gt;What is the normal/default behaviour?&lt;BR /&gt;&lt;BR /&gt;What you are doing is illegal for this exact reason, you can't read and write to the same file.&lt;BR /&gt;The first thing I thought of is for you to remove that evil cat(1).&lt;BR /&gt;&lt;BR /&gt;But the correct fix is to use:&lt;BR /&gt;$ sort -o a.txt a.txt</description>
      <pubDate>Wed, 16 Jul 2008 04:53:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/strange-redirection-or-piping-problem/m-p/4234575#M675869</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2008-07-16T04:53:57Z</dc:date>
    </item>
    <item>
      <title>Re: strange redirection or piping problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/strange-redirection-or-piping-problem/m-p/4234576#M675872</link>
      <description>Thanks for the reply.&lt;BR /&gt;&lt;BR /&gt;I believe so, it is illegal, but why in the dev system, I could do it. &lt;BR /&gt;&lt;BR /&gt;The problem is some developer using this syntax on the dev system (but not pipe to sort but pipe to sed) and the script running fine, then after he migrated to prod them the problem come. &lt;BR /&gt;&lt;BR /&gt;Yes I thought it is illegal command that can zero the file, I asked the developer to change the script, but I am curious for the inconsistency. &lt;BR /&gt;</description>
      <pubDate>Thu, 17 Jul 2008 08:30:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/strange-redirection-or-piping-problem/m-p/4234576#M675872</guid>
      <dc:creator>irt_1</dc:creator>
      <dc:date>2008-07-17T08:30:48Z</dc:date>
    </item>
    <item>
      <title>Re: strange redirection or piping problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/strange-redirection-or-piping-problem/m-p/4234577#M675873</link>
      <description>&amp;gt;but why in the dev system, I could do it?&lt;BR /&gt;&lt;BR /&gt;It's illegal because it is inconsistent.  ;-)&lt;BR /&gt;&lt;BR /&gt;&amp;gt;but I am curious for the inconsistency.&lt;BR /&gt;&lt;BR /&gt;I'm pretty sure the pipe buffer size is the same on all HP-UX systems.  I would have thought it related to the size that you are reading before writing back.  It could be related to the OS version and any patches you have.</description>
      <pubDate>Thu, 17 Jul 2008 08:48:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/strange-redirection-or-piping-problem/m-p/4234577#M675873</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2008-07-17T08:48:54Z</dc:date>
    </item>
    <item>
      <title>Re: strange redirection or piping problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/strange-redirection-or-piping-problem/m-p/4234578#M675875</link>
      <description>Hi Iwan,&lt;BR /&gt;&lt;BR /&gt;I would not call it an inconsistency - the behaviour is just undetermined:&lt;BR /&gt;May be, there is a higher probability, that a multi-CPU machine shows a NULL-sized file, but a slow an single CPU. May be the other way round ...&lt;BR /&gt;&lt;BR /&gt;mfG Peter</description>
      <pubDate>Thu, 17 Jul 2008 08:52:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/strange-redirection-or-piping-problem/m-p/4234578#M675875</guid>
      <dc:creator>Peter Nikitka</dc:creator>
      <dc:date>2008-07-17T08:52:38Z</dc:date>
    </item>
    <item>
      <title>Re: strange redirection or piping problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/strange-redirection-or-piping-problem/m-p/4234579#M675876</link>
      <description>Shalom,&lt;BR /&gt;&lt;BR /&gt;Try and read and write to the same file at the same time, with say two separate processes.&lt;BR /&gt;&lt;BR /&gt;Have the write process put in legible english words.&lt;BR /&gt;&lt;BR /&gt;Think that's what the output is going to look like? No.&lt;BR /&gt;&lt;BR /&gt;The reason Unix shell does not permit read and write of the same file at the same time is to give you some chance of having a consistent, usable file at the end of the day.&lt;BR /&gt;&lt;BR /&gt;Accept this rule as fact and move on.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Thu, 17 Jul 2008 10:08:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/strange-redirection-or-piping-problem/m-p/4234579#M675876</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2008-07-17T10:08:36Z</dc:date>
    </item>
  </channel>
</rss>

