<?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: UNIX script help in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/unix-script-help/m-p/2736666#M66689</link>
    <description>Try this:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;typeset -i i=0&lt;BR /&gt;if [ $# -eq 2 ]&lt;BR /&gt;then&lt;BR /&gt;   if [ -s $1 ]&lt;BR /&gt;   then&lt;BR /&gt;      while read i line&lt;BR /&gt;      do&lt;BR /&gt;         if [ $i -lt 1100 ]&lt;BR /&gt;         then&lt;BR /&gt;            echo $line&lt;BR /&gt;         fi&lt;BR /&gt;      done &amp;lt; $1 &amp;gt; $2&lt;BR /&gt;   fi&lt;BR /&gt;fi&lt;BR /&gt;</description>
    <pubDate>Mon, 03 Jun 2002 20:29:10 GMT</pubDate>
    <dc:creator>Jordan Bean</dc:creator>
    <dc:date>2002-06-03T20:29:10Z</dc:date>
    <item>
      <title>UNIX script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/unix-script-help/m-p/2736663#M66686</link>
      <description>Hi! List,&lt;BR /&gt;I am trying to write a script which will check the first field in art1 file, if it is less than 1100 it should print second field.&lt;BR /&gt;&lt;BR /&gt;Here is the script:&lt;BR /&gt; #!/bin/sh&lt;BR /&gt;#&lt;BR /&gt;# Usage : &amp;lt;script_name&amp;gt; input_file output_file&lt;BR /&gt;####&lt;BR /&gt;&lt;BR /&gt;# Removes previous output file&lt;BR /&gt;rm $2 2&amp;gt;/dev/null&lt;BR /&gt;&lt;BR /&gt;while read LINE&lt;BR /&gt;do&lt;BR /&gt; FST_FIELD=`echo $LINE | cut -d " " -f 1`&lt;BR /&gt; SND_FIELD=`echo $LINE | cut -d " " -f 2`&lt;BR /&gt; if (( ${FST_FIELD} &amp;lt; 1100 ))&lt;BR /&gt; then&lt;BR /&gt;    echo 'First field = '$FST_FIELD' Second Field = '$SND_FIELD &lt;BR /&gt; fi&lt;BR /&gt;done &amp;lt; /tmp/art1&lt;BR /&gt;&lt;BR /&gt;Errors:&lt;BR /&gt;SND_FIELD=200205281021_3cf3925c.137f.69_BW.html&lt;BR /&gt;+ 9416 &lt;BR /&gt;rmb1.sh: 9416: not found&lt;BR /&gt;+ read LINE &lt;BR /&gt;+ echo 9496 200205281021_3cf3925c.137f.94_BW.html &lt;BR /&gt;+ cut -d   -f 1 &lt;BR /&gt;FST_FIELD=9496&lt;BR /&gt;+ echo 9496 200205281021_3cf3925c.137f.94_BW.html &lt;BR /&gt;+ cut -d   -f 2 &lt;BR /&gt;SND_FIELD=200205281021_3cf3925c.137f.94_BW.html&lt;BR /&gt;+ 9496 &lt;BR /&gt;rmb1.sh: 9496: not found&lt;BR /&gt;+ read LINE &lt;BR /&gt;+ echo 5659 200205281021_3cf3925d.137f.148_BW.html &lt;BR /&gt;+ cut -d   -f 1 &lt;BR /&gt;FST_FIELD=5659&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;contents of /tmp/art1&lt;BR /&gt;4301 200206030418_3cfb5e62.3e6b.169.1.html&lt;BR /&gt;1710 200206030418_3cfb5e63.3e6b.170.1.html&lt;BR /&gt;5155 200206030443_3cfb6381.582d.51.2.html&lt;BR /&gt;6254 200206030443_3cfb6386.582d.53.2.html&lt;BR /&gt;4301 200206030443_3cfb638f.582d.58.2.html&lt;BR /&gt;4202 200206030443_3cfb63a1.582d.70.1.html&lt;BR /&gt;3817 200206030443_3cfb6457.582d.184.1_UPI.html&lt;BR /&gt;3119 200206030443_3cfb645a.582d.186.1.html&lt;BR /&gt;3833 200206030518_3cfb6b67.343.34.2.html&lt;BR /&gt;3599 200206030518_3cfb6b87.343.56.2.html&lt;BR /&gt;&lt;BR /&gt;Script is failing to compare, any ideas?&lt;BR /&gt;&lt;BR /&gt;Thanks in advance&lt;BR /&gt;</description>
      <pubDate>Mon, 03 Jun 2002 19:59:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/unix-script-help/m-p/2736663#M66686</guid>
      <dc:creator>Robert_73</dc:creator>
      <dc:date>2002-06-03T19:59:29Z</dc:date>
    </item>
    <item>
      <title>Re: UNIX script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/unix-script-help/m-p/2736664#M66687</link>
      <description>Change your if&lt;BR /&gt;if (( ${FST_FIELD} &amp;lt; 1100 )) &lt;BR /&gt;to&lt;BR /&gt;if [ ${FST_FIELD} -lt 1100 ]&lt;BR /&gt;then&lt;BR /&gt;....&lt;BR /&gt;....&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 03 Jun 2002 20:14:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/unix-script-help/m-p/2736664#M66687</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2002-06-03T20:14:50Z</dc:date>
    </item>
    <item>
      <title>Re: UNIX script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/unix-script-help/m-p/2736665#M66688</link>
      <description>Also:&lt;BR /&gt;&lt;BR /&gt;echo 'First field = '$FST_FIELD' Second Field = '$SND_FIELD &lt;BR /&gt;&lt;BR /&gt;should be&lt;BR /&gt;echo "First field = \"${FST_FIELD}\" Second Field = \"${SND_FIELD}\""&lt;BR /&gt;&lt;BR /&gt;You want the shell to interpret the values, hence " rather than '.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 03 Jun 2002 20:17:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/unix-script-help/m-p/2736665#M66688</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2002-06-03T20:17:42Z</dc:date>
    </item>
    <item>
      <title>Re: UNIX script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/unix-script-help/m-p/2736666#M66689</link>
      <description>Try this:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;typeset -i i=0&lt;BR /&gt;if [ $# -eq 2 ]&lt;BR /&gt;then&lt;BR /&gt;   if [ -s $1 ]&lt;BR /&gt;   then&lt;BR /&gt;      while read i line&lt;BR /&gt;      do&lt;BR /&gt;         if [ $i -lt 1100 ]&lt;BR /&gt;         then&lt;BR /&gt;            echo $line&lt;BR /&gt;         fi&lt;BR /&gt;      done &amp;lt; $1 &amp;gt; $2&lt;BR /&gt;   fi&lt;BR /&gt;fi&lt;BR /&gt;</description>
      <pubDate>Mon, 03 Jun 2002 20:29:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/unix-script-help/m-p/2736666#M66689</guid>
      <dc:creator>Jordan Bean</dc:creator>
      <dc:date>2002-06-03T20:29:10Z</dc:date>
    </item>
    <item>
      <title>Re: UNIX script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/unix-script-help/m-p/2736667#M66690</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;awk is also a good tool for this type of problems. Try:&lt;BR /&gt;awk '$1 &amp;lt; 1100 { print $2 }'</description>
      <pubDate>Tue, 04 Jun 2002 07:16:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/unix-script-help/m-p/2736667#M66690</guid>
      <dc:creator>Leif Halvarsson_2</dc:creator>
      <dc:date>2002-06-04T07:16:34Z</dc:date>
    </item>
    <item>
      <title>Re: UNIX script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/unix-script-help/m-p/2736668#M66691</link>
      <description>Hi Robert,&lt;BR /&gt;&lt;BR /&gt;two mistakes in your script:&lt;BR /&gt;&lt;BR /&gt;if [ $FST_FIELD -lt 1100 ]&lt;BR /&gt;then&lt;BR /&gt;echo "First field = $FST_FIELD Second Field = $SND_FIELD"&lt;BR /&gt;......&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;will do it for you.&lt;BR /&gt;&lt;BR /&gt;Allways stay on the bright side of life!&lt;BR /&gt;&lt;BR /&gt;Peter</description>
      <pubDate>Tue, 04 Jun 2002 07:49:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/unix-script-help/m-p/2736668#M66691</guid>
      <dc:creator>Peter Kloetgen</dc:creator>
      <dc:date>2002-06-04T07:49:07Z</dc:date>
    </item>
  </channel>
</rss>

