<?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 Help with standard input to a script. in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/help-with-standard-input-to-a-script/m-p/2676416#M906802</link>
    <description>Hi People.&lt;BR /&gt;&lt;BR /&gt;I have a requirement for a script that can handle a file that is piped in via standard input.&lt;BR /&gt;i.e cat inputfile | my_script&lt;BR /&gt;Once inside the script how can I reference the inputfile? &lt;BR /&gt;With normal inputs you can use $1 $2 etc, is there anything like that for piped input??&lt;BR /&gt;&lt;BR /&gt;Cheers&lt;BR /&gt;Russ.</description>
    <pubDate>Tue, 05 Mar 2002 11:42:50 GMT</pubDate>
    <dc:creator>Russ Hancock_1</dc:creator>
    <dc:date>2002-03-05T11:42:50Z</dc:date>
    <item>
      <title>Help with standard input to a script.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-with-standard-input-to-a-script/m-p/2676416#M906802</link>
      <description>Hi People.&lt;BR /&gt;&lt;BR /&gt;I have a requirement for a script that can handle a file that is piped in via standard input.&lt;BR /&gt;i.e cat inputfile | my_script&lt;BR /&gt;Once inside the script how can I reference the inputfile? &lt;BR /&gt;With normal inputs you can use $1 $2 etc, is there anything like that for piped input??&lt;BR /&gt;&lt;BR /&gt;Cheers&lt;BR /&gt;Russ.</description>
      <pubDate>Tue, 05 Mar 2002 11:42:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-with-standard-input-to-a-script/m-p/2676416#M906802</guid>
      <dc:creator>Russ Hancock_1</dc:creator>
      <dc:date>2002-03-05T11:42:50Z</dc:date>
    </item>
    <item>
      <title>Re: Help with standard input to a script.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-with-standard-input-to-a-script/m-p/2676417#M906803</link>
      <description>All you need to do is something like this:&lt;BR /&gt;&lt;BR /&gt;while read X |&lt;BR /&gt;do&lt;BR /&gt;  echo $X&lt;BR /&gt;# reads stdin 1 line at a time&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;If you would like split each line into $1, $2, ...&lt;BR /&gt;&lt;BR /&gt;ARGS=$*&lt;BR /&gt;while read X |&lt;BR /&gt;do&lt;BR /&gt;  set $X&lt;BR /&gt;# now $X has been split into $1, $2, ...&lt;BR /&gt;# $# is the number of vars&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;No points please, Clay</description>
      <pubDate>Tue, 05 Mar 2002 18:50:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-with-standard-input-to-a-script/m-p/2676417#M906803</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2002-03-05T18:50:54Z</dc:date>
    </item>
    <item>
      <title>Re: Help with standard input to a script.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-with-standard-input-to-a-script/m-p/2676418#M906804</link>
      <description>Hi Russ,&lt;BR /&gt;&lt;BR /&gt;I would use an exported variable, which can then be read within your script:&lt;BR /&gt;&lt;BR /&gt;FILE=inputfile&lt;BR /&gt;export FILE&lt;BR /&gt;cat $FILE | your_script&lt;BR /&gt;&lt;BR /&gt;Rgds, Robin.</description>
      <pubDate>Tue, 05 Mar 2002 19:39:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-with-standard-input-to-a-script/m-p/2676418#M906804</guid>
      <dc:creator>Robin Wakefield</dc:creator>
      <dc:date>2002-03-05T19:39:36Z</dc:date>
    </item>
    <item>
      <title>Re: Help with standard input to a script.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-with-standard-input-to-a-script/m-p/2676419#M906805</link>
      <description>Russ,&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;while read w1 w2 w3 w4 w5 w6 w7 w8 w9 w10&lt;BR /&gt;do&lt;BR /&gt;echo $w1 $w2 $w3 $w4 $w5 $w6 $w7 $w8 $w9 $w10&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;live free or die&lt;BR /&gt;harry</description>
      <pubDate>Wed, 06 Mar 2002 02:15:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-with-standard-input-to-a-script/m-p/2676419#M906805</guid>
      <dc:creator>harry d brown jr</dc:creator>
      <dc:date>2002-03-06T02:15:25Z</dc:date>
    </item>
    <item>
      <title>Re: Help with standard input to a script.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-with-standard-input-to-a-script/m-p/2676420#M906806</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I agree with Robin. &lt;BR /&gt;&lt;BR /&gt;Had wanted to post exactly the same yesterday but was unable to due to forum connectivity issues with replying.&lt;BR /&gt;&lt;BR /&gt;Hope this helps. Regards.&lt;BR /&gt;&lt;BR /&gt;Steven Sim Kok Leong</description>
      <pubDate>Wed, 06 Mar 2002 02:28:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-with-standard-input-to-a-script/m-p/2676420#M906806</guid>
      <dc:creator>Steven Sim Kok Leong</dc:creator>
      <dc:date>2002-03-06T02:28:39Z</dc:date>
    </item>
    <item>
      <title>Re: Help with standard input to a script.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-with-standard-input-to-a-script/m-p/2676421#M906807</link>
      <description>Hi ,&lt;BR /&gt;&lt;BR /&gt;why don't you simply change positions using command substitution:&lt;BR /&gt;&lt;BR /&gt;your_script `cat input_file`&lt;BR /&gt;&lt;BR /&gt;you use the standard input for the input file and you get a parameter list which you can use inside your script...&lt;BR /&gt;&lt;BR /&gt;Allways stay on the bright side of life!&lt;BR /&gt;&lt;BR /&gt;Peter</description>
      <pubDate>Wed, 06 Mar 2002 07:14:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-with-standard-input-to-a-script/m-p/2676421#M906807</guid>
      <dc:creator>Peter Kloetgen</dc:creator>
      <dc:date>2002-03-06T07:14:43Z</dc:date>
    </item>
    <item>
      <title>Re: Help with standard input to a script.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-with-standard-input-to-a-script/m-p/2676422#M906808</link>
      <description>Well, you can do it on this way:&lt;BR /&gt;&lt;BR /&gt;# your_script inputfile&lt;BR /&gt;&lt;BR /&gt;In your_script, you can add these lines:&lt;BR /&gt;&lt;BR /&gt;while read field1 field2 field3&lt;BR /&gt;do&lt;BR /&gt;   your_process&lt;BR /&gt;done &amp;lt; $1&lt;BR /&gt;&lt;BR /&gt;This will read the lines from your inputfile and do the process that you want. If you inputfile had 7 fields, add up to field7 in the 'while' line.&lt;BR /&gt;&lt;BR /&gt;Hope this helps.&lt;BR /&gt;Kenny.</description>
      <pubDate>Wed, 06 Mar 2002 07:48:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-with-standard-input-to-a-script/m-p/2676422#M906808</guid>
      <dc:creator>Kenny Chau</dc:creator>
      <dc:date>2002-03-06T07:48:40Z</dc:date>
    </item>
  </channel>
</rss>

