<?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: posix shell script array in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/posix-shell-script-array/m-p/2989449#M913066</link>
    <description>Hi,&lt;BR /&gt;&lt;BR /&gt;If I read this correctly, and without using perl, you maybe want something like:&lt;BR /&gt;&lt;BR /&gt;while :;do&lt;BR /&gt; i=0&lt;BR /&gt; while [ $i -ne 5 ]; do&lt;BR /&gt;  read line || break&lt;BR /&gt;  a[$i]=$line&lt;BR /&gt;  let i=i+1&lt;BR /&gt; done&lt;BR /&gt; echo ${a[*]}&lt;BR /&gt; sleep 1&lt;BR /&gt; test "$line" || exit&lt;BR /&gt; unset a&lt;BR /&gt; i=0&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;then you'd run it by typing:&lt;BR /&gt;&lt;BR /&gt;cat textfile.txt | scriptname&lt;BR /&gt;&lt;BR /&gt;the script sleeps for one sec. after reading 5 lines, that's where you could put your filter.&lt;BR /&gt;&lt;BR /&gt;rgds, Robin</description>
    <pubDate>Thu, 05 Jun 2003 08:57:30 GMT</pubDate>
    <dc:creator>Robin Wakefield</dc:creator>
    <dc:date>2003-06-05T08:57:30Z</dc:date>
    <item>
      <title>posix shell script array</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/posix-shell-script-array/m-p/2989445#M913062</link>
      <description>Anybody could be help ?&lt;BR /&gt;&lt;BR /&gt;if I have text file as below&lt;BR /&gt;&lt;BR /&gt;---------------textfile.txt-----------------&lt;BR /&gt;messages line 1&lt;BR /&gt;messages line 2&lt;BR /&gt;messages line 3&lt;BR /&gt;messages line 4&lt;BR /&gt;messages line 5&lt;BR /&gt;messages line 6&lt;BR /&gt;messages line 7&lt;BR /&gt;messages line 8&lt;BR /&gt;messages line 9&lt;BR /&gt;messages line 10&lt;BR /&gt;------------------------------------------------&lt;BR /&gt;&lt;BR /&gt;I want to cut every 5 lines and send to filter &lt;BR /&gt;and then go to next 5 lines and send to filter again until end of file with out using temp file&lt;BR /&gt;(because I want to tuning performance , my old script using temp file and sed command to cut line 1 to 5 &lt;BR /&gt;from temp file and send to filter)&lt;BR /&gt;&lt;BR /&gt;I got input from program just like command as below&lt;BR /&gt;&lt;BR /&gt;cat textfile.txt|tee&lt;BR /&gt;&lt;BR /&gt;I want to use output from this command just like&lt;BR /&gt;&lt;BR /&gt;cat textfile.txt|tee&lt;BR /&gt;program ....&lt;BR /&gt;...&lt;BR /&gt;...&lt;BR /&gt;&lt;BR /&gt;How can I write shell script to handle this process&lt;BR /&gt;I can not use "while read -r xx" command because this command get input from text file but I want to insert this&lt;BR /&gt;code to my program.&lt;BR /&gt;&lt;BR /&gt;Can I use array ?&lt;BR /&gt;&lt;BR /&gt;Many thanks.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 05 Jun 2003 06:42:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/posix-shell-script-array/m-p/2989445#M913062</guid>
      <dc:creator>Wiboon Tanakitpaisal_1</dc:creator>
      <dc:date>2003-06-05T06:42:42Z</dc:date>
    </item>
    <item>
      <title>Re: posix shell script array</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/posix-shell-script-array/m-p/2989446#M913063</link>
      <description>hi,&lt;BR /&gt;&lt;BR /&gt;I don't really understand what you need. Could you please be more explicit on your input and output and how you want to use it or perhaps even post your old script ?&lt;BR /&gt;&lt;BR /&gt;Regards.</description>
      <pubDate>Thu, 05 Jun 2003 08:29:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/posix-shell-script-array/m-p/2989446#M913063</guid>
      <dc:creator>Jean-Louis Phelix</dc:creator>
      <dc:date>2003-06-05T08:29:58Z</dc:date>
    </item>
    <item>
      <title>Re: posix shell script array</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/posix-shell-script-array/m-p/2989447#M913064</link>
      <description>If you want performance for text -prosessing, filtering and re-formatting, use perl-scripts.&lt;BR /&gt;&lt;BR /&gt;Rgds Jarle</description>
      <pubDate>Thu, 05 Jun 2003 08:39:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/posix-shell-script-array/m-p/2989447#M913064</guid>
      <dc:creator>Jarle Bjorgeengen</dc:creator>
      <dc:date>2003-06-05T08:39:26Z</dc:date>
    </item>
    <item>
      <title>Re: posix shell script array</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/posix-shell-script-array/m-p/2989448#M913065</link>
      <description>My old script as below , this script use $file as temp file,if I can do this job without temp file it will better.&lt;BR /&gt; &lt;BR /&gt;--------&lt;BR /&gt;&lt;BR /&gt;.&lt;BR /&gt;.&lt;BR /&gt;.&lt;BR /&gt;&lt;BR /&gt;/usr/bin/tee | sed 's/^C//' | pr -t -l${_length} &amp;gt; $file                     &lt;BR /&gt;&lt;BR /&gt;reset_printer&lt;BR /&gt;&lt;BR /&gt;cat /usr/lib/asx/thai/pre15cpi.fnt&lt;BR /&gt;cat /usr/lib/asx/thai/thaib410n.fnt&lt;BR /&gt;echo "^[(1X\c"&lt;BR /&gt;esc1="^[\&amp;amp;\l5C"&lt;BR /&gt;esc2="^[\&amp;amp;\l48D"&lt;BR /&gt;&lt;BR /&gt;FileLen=`cat $file|wc -l`&lt;BR /&gt;nLoop=`expr $FileLen / $_length`&lt;BR /&gt;LastLen=`expr $FileLen % $_length`&lt;BR /&gt;LoopCount=1                                                                  &lt;BR /&gt;ARG="-pr=/usr/lib/asx/thai/prn/dumb -i=/usr/lib/asx/thai/code/sic-tis -o=/usr/lib/asx/thai/code/tis-sic -rm400 -cb2 -lpg44"&lt;BR /&gt;while [ ${LoopCount} -le ${nLoop} ]&lt;BR /&gt;do&lt;BR /&gt;   cat $PCL_FILE      # Print Pre-Printed Form&lt;BR /&gt;&lt;BR /&gt;   case ${_job_name} in&lt;BR /&gt;         CSA*) echo "^[&amp;amp;a3R^[&amp;amp;a1C\c"&lt;BR /&gt;              echo "\033&amp;amp;a5L\c"   # set left margin&lt;BR /&gt;              ;;&lt;BR /&gt;      esac&lt;BR /&gt;                                                                                &lt;BR /&gt;      StartLine=`expr \( $LoopCount - 1 \) \* $_length + 1`&lt;BR /&gt;      EndLine=`expr $LoopCount \* $_length`&lt;BR /&gt;&lt;BR /&gt;      sed -n "$StartLine,$EndLine p" $file |&lt;BR /&gt;        /usr/lbin/thfil $ARG|sed 'G&lt;BR /&gt;        s/\n/'$esc1'/&lt;BR /&gt;        n&lt;BR /&gt;        n&lt;BR /&gt;        G&lt;BR /&gt;        s/\n/'$esc2'/'&lt;BR /&gt;      LoopCount=`expr $LoopCount + 1`&lt;BR /&gt;   done&lt;BR /&gt;&lt;BR /&gt;   if [ $LastLen -gt 0 ]&lt;BR /&gt;   then                                                                         &lt;BR /&gt;      cat $PCL_FILE      # Print Pre-Printed Form&lt;BR /&gt;&lt;BR /&gt;      case ${_job_name} in&lt;BR /&gt;         CSA*) echo "^[&amp;amp;a3R^[&amp;amp;a1C\c"&lt;BR /&gt;              echo "\033&amp;amp;a5L\c"   # set left margin&lt;BR /&gt;              ;;&lt;BR /&gt;      esac&lt;BR /&gt;&lt;BR /&gt;      StartLine=`expr $nLoop \* $_length + 1`&lt;BR /&gt;      EndLine=`expr $FileLen`&lt;BR /&gt;      sed -n "$StartLine,$EndLine p" $file |&lt;BR /&gt;        /usr/lbin/thfil $ARG|sed 'G&lt;BR /&gt;        s/\n/'$esc1'/&lt;BR /&gt;        n&lt;BR /&gt;        n&lt;BR /&gt;        G&lt;BR /&gt;        s/\n/'$esc2'/'&lt;BR /&gt;   fi&lt;BR /&gt;&lt;BR /&gt;   font_reset&lt;BR /&gt;&lt;BR /&gt;  rm -f $file</description>
      <pubDate>Thu, 05 Jun 2003 08:42:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/posix-shell-script-array/m-p/2989448#M913065</guid>
      <dc:creator>Wiboon Tanakitpaisal_1</dc:creator>
      <dc:date>2003-06-05T08:42:37Z</dc:date>
    </item>
    <item>
      <title>Re: posix shell script array</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/posix-shell-script-array/m-p/2989449#M913066</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;If I read this correctly, and without using perl, you maybe want something like:&lt;BR /&gt;&lt;BR /&gt;while :;do&lt;BR /&gt; i=0&lt;BR /&gt; while [ $i -ne 5 ]; do&lt;BR /&gt;  read line || break&lt;BR /&gt;  a[$i]=$line&lt;BR /&gt;  let i=i+1&lt;BR /&gt; done&lt;BR /&gt; echo ${a[*]}&lt;BR /&gt; sleep 1&lt;BR /&gt; test "$line" || exit&lt;BR /&gt; unset a&lt;BR /&gt; i=0&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;then you'd run it by typing:&lt;BR /&gt;&lt;BR /&gt;cat textfile.txt | scriptname&lt;BR /&gt;&lt;BR /&gt;the script sleeps for one sec. after reading 5 lines, that's where you could put your filter.&lt;BR /&gt;&lt;BR /&gt;rgds, Robin</description>
      <pubDate>Thu, 05 Jun 2003 08:57:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/posix-shell-script-array/m-p/2989449#M913066</guid>
      <dc:creator>Robin Wakefield</dc:creator>
      <dc:date>2003-06-05T08:57:30Z</dc:date>
    </item>
    <item>
      <title>Re: posix shell script array</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/posix-shell-script-array/m-p/2989450#M913067</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I'm not sure that it would really be an enhancement but you can also use read with -p option.&lt;BR /&gt;&lt;BR /&gt;just add "|&amp;amp;" at the end of first sed and use read -p to get input later in the script :&lt;BR /&gt;&lt;BR /&gt;/usr/bin/tee | sed 's/^C//' | pr -t -l${_length} |&amp;amp;&lt;BR /&gt;...&lt;BR /&gt;&lt;BR /&gt;while read -p xxx&lt;BR /&gt;&lt;BR /&gt;A simplier example of this usage would be :&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;ll |&amp;amp;&lt;BR /&gt;while read -p file&lt;BR /&gt;do&lt;BR /&gt;  echo "***$file***"&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;You will see that each line of ll input will be read as needed.&lt;BR /&gt;&lt;BR /&gt;Regards.</description>
      <pubDate>Thu, 05 Jun 2003 09:38:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/posix-shell-script-array/m-p/2989450#M913067</guid>
      <dc:creator>Jean-Louis Phelix</dc:creator>
      <dc:date>2003-06-05T09:38:11Z</dc:date>
    </item>
    <item>
      <title>Re: posix shell script array</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/posix-shell-script-array/m-p/2989451#M913068</link>
      <description>I got new problem I can not use read command because read command read line from std input (console) but this script call from another program and no tty for this process, I think awk may be work . Anybody can write this script with array in awk ? Could you please show me the example of script.</description>
      <pubDate>Tue, 10 Jun 2003 07:54:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/posix-shell-script-array/m-p/2989451#M913068</guid>
      <dc:creator>Wiboon Tanakitpaisal_1</dc:creator>
      <dc:date>2003-06-10T07:54:05Z</dc:date>
    </item>
  </channel>
</rss>

