<?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: script query in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/script-query/m-p/4940016#M797684</link>
    <description>i did as above and still getting problems. when i did sh -xvf on it, it gave me output like the following:&lt;BR /&gt;&lt;BR /&gt;+ read SURNAME FIRSTNAME&lt;BR /&gt;+ cut -c1-5&lt;BR /&gt;+ echoAncliff&lt;BR /&gt;createuname.sh[3]: echoAncliff:  not found.&lt;BR /&gt;+ typeset -l SNAME=&lt;BR /&gt;+ [ 0 -lt 5 ]&lt;BR /&gt;+ SNAME=a&lt;BR /&gt;+ cut -c1&lt;BR /&gt;+ typeset -l FNAME=Gillian&lt;BR /&gt;+ + echo a&lt;BR /&gt;UNAME=a&lt;BR /&gt;+ echo a&lt;BR /&gt;a&lt;BR /&gt;+ read SURNAME FIRSTNAME&lt;BR /&gt;+ cut -c1-5&lt;BR /&gt;+ echoAnderson&lt;BR /&gt;createuname.sh[3]: echoAnderson:  not found.&lt;BR /&gt;+ typeset -l SNAME=&lt;BR /&gt;+ [ 0 -lt 5 ]&lt;BR /&gt;+ SNAME=a&lt;BR /&gt;+ cut -c1&lt;BR /&gt;+ typeset -l FNAME=Jean&lt;BR /&gt;+ + echo a&lt;BR /&gt;UNAME=a&lt;BR /&gt;+ echo a&lt;BR /&gt;a&lt;BR /&gt;+ read SURNAME FIRSTNAME&lt;BR /&gt;+ cut -c1-5&lt;BR /&gt;+ echoAnderson&lt;BR /&gt;</description>
    <pubDate>Fri, 11 Nov 2005 06:47:53 GMT</pubDate>
    <dc:creator>Ravinder Singh Gill</dc:creator>
    <dc:date>2005-11-11T06:47:53Z</dc:date>
    <item>
      <title>script query</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-query/m-p/4940009#M797677</link>
      <description>Hi guys can anybody spot the problem with the following query?&lt;BR /&gt;&lt;BR /&gt;while read SURNAME FIRSTNAME&lt;BR /&gt;do&lt;BR /&gt;typeset -l SNAME=$SURNAME | cut -c1-5&lt;BR /&gt;&lt;BR /&gt;while [ ${#SNAME} -lt 5 ]&lt;BR /&gt;do&lt;BR /&gt;SNAME=$SNAME"a"&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;typeset -l FNAME=$FIRSTNAME | cut -c1&lt;BR /&gt;&lt;BR /&gt;UNAME=`echo $SNAME$FNAME`&lt;BR /&gt;do&lt;BR /&gt;echo $UNAME&lt;BR /&gt;done&lt;BR /&gt;done &amp;lt; file1.txt&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Basically from a list of names I am trying to create a list of Unames (first 5 characters of surname and first initial - "a" is used as padding if surname is less than 5 characters). I am using file1.txt for this. A sh -xvf shows the following:&lt;BR /&gt;&lt;BR /&gt;while read SURNAME FIRSTNAME&lt;BR /&gt;do&lt;BR /&gt;typeset -l SNAME=$SURNAME | cut -c1-5&lt;BR /&gt;&lt;BR /&gt;while [ ${#SNAME} -lt 5 ]&lt;BR /&gt;do&lt;BR /&gt;SNAME=$SNAME"a"&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;typeset -l FNAME=$FIRSTNAME | cut -c1&lt;BR /&gt;&lt;BR /&gt;UNAME=`echo $SNAME$FNAME`&lt;BR /&gt;do&lt;BR /&gt;createuname.sh: Syntax error at line 14 : `do' is not expected.&lt;BR /&gt;</description>
      <pubDate>Fri, 11 Nov 2005 05:26:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-query/m-p/4940009#M797677</guid>
      <dc:creator>Ravinder Singh Gill</dc:creator>
      <dc:date>2005-11-11T05:26:12Z</dc:date>
    </item>
    <item>
      <title>Re: script query</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-query/m-p/4940010#M797678</link>
      <description>set -vx and run script. It will tell you where it is erroring out.</description>
      <pubDate>Fri, 11 Nov 2005 05:30:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-query/m-p/4940010#M797678</guid>
      <dc:creator>RAC_1</dc:creator>
      <dc:date>2005-11-11T05:30:02Z</dc:date>
    </item>
    <item>
      <title>Re: script query</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-query/m-p/4940011#M797679</link>
      <description>how do i set that? can you give an example please</description>
      <pubDate>Fri, 11 Nov 2005 05:32:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-query/m-p/4940011#M797679</guid>
      <dc:creator>Ravinder Singh Gill</dc:creator>
      <dc:date>2005-11-11T05:32:00Z</dc:date>
    </item>
    <item>
      <title>Re: script query</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-query/m-p/4940012#M797680</link>
      <description>You can use like this,&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;UNAME=`echo $SNAME$FNAME`&lt;BR /&gt;do&lt;BR /&gt;echo $UNAME&lt;BR /&gt;done&lt;BR /&gt;done &amp;lt; file1.txt&lt;BR /&gt;&lt;BR /&gt;hth.</description>
      <pubDate>Fri, 11 Nov 2005 05:35:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-query/m-p/4940012#M797680</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2005-11-11T05:35:11Z</dc:date>
    </item>
    <item>
      <title>Re: script query</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-query/m-p/4940013#M797681</link>
      <description>You cannot use like this,&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;UNAME=`echo $SNAME$FNAME`&lt;BR /&gt;do&lt;BR /&gt;echo $UNAME&lt;BR /&gt;done&lt;BR /&gt;done &amp;lt; file1.txt&lt;BR /&gt;&lt;BR /&gt;hth.</description>
      <pubDate>Fri, 11 Nov 2005 05:35:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-query/m-p/4940013#M797681</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2005-11-11T05:35:19Z</dc:date>
    </item>
    <item>
      <title>Re: script query</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-query/m-p/4940014#M797682</link>
      <description>sorry for typo(s) :)&lt;BR /&gt;&lt;BR /&gt;Try as,&lt;BR /&gt;&lt;BR /&gt;while read SURNAME FIRSTNAME&lt;BR /&gt;do&lt;BR /&gt;typeset -l SNAME=$SURNAME | cut -c1-5&lt;BR /&gt;&lt;BR /&gt;while [ ${#SNAME} -lt 5 ]&lt;BR /&gt;do&lt;BR /&gt;SNAME=$SNAME"a"&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;typeset -l FNAME=$FIRSTNAME | cut -c1&lt;BR /&gt;&lt;BR /&gt;UNAME=`echo $SNAME$FNAME`&lt;BR /&gt;echo $UNAME&lt;BR /&gt;&lt;BR /&gt;done &amp;lt; file1.txt&lt;BR /&gt;&lt;BR /&gt;It will work.</description>
      <pubDate>Fri, 11 Nov 2005 05:36:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-query/m-p/4940014#M797682</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2005-11-11T05:36:21Z</dc:date>
    </item>
    <item>
      <title>Re: script query</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-query/m-p/4940015#M797683</link>
      <description>Really bad today :(.&lt;BR /&gt;&lt;BR /&gt;Try this:&lt;BR /&gt;&lt;BR /&gt;while read SURNAME FIRSTNAME&lt;BR /&gt;do&lt;BR /&gt;&lt;BR /&gt;typeset -l SNAME=$(echo $SURNAME | cut -c1-5)&lt;BR /&gt;&lt;BR /&gt;if [ ${#SNAME} -lt 5 ]&lt;BR /&gt;then&lt;BR /&gt;SNAME=$SNAME"a"&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;typeset -l FNAME=$(echo $FIRSTNAME | cut -c1)&lt;BR /&gt;&lt;BR /&gt;UNAME=`echo "$SNAME$FNAME"`&lt;BR /&gt;echo $UNAME&lt;BR /&gt;&lt;BR /&gt;done &amp;lt; file1.txt&lt;BR /&gt;&lt;BR /&gt;It will work.&lt;BR /&gt;&lt;BR /&gt;hth.</description>
      <pubDate>Fri, 11 Nov 2005 05:40:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-query/m-p/4940015#M797683</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2005-11-11T05:40:44Z</dc:date>
    </item>
    <item>
      <title>Re: script query</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-query/m-p/4940016#M797684</link>
      <description>i did as above and still getting problems. when i did sh -xvf on it, it gave me output like the following:&lt;BR /&gt;&lt;BR /&gt;+ read SURNAME FIRSTNAME&lt;BR /&gt;+ cut -c1-5&lt;BR /&gt;+ echoAncliff&lt;BR /&gt;createuname.sh[3]: echoAncliff:  not found.&lt;BR /&gt;+ typeset -l SNAME=&lt;BR /&gt;+ [ 0 -lt 5 ]&lt;BR /&gt;+ SNAME=a&lt;BR /&gt;+ cut -c1&lt;BR /&gt;+ typeset -l FNAME=Gillian&lt;BR /&gt;+ + echo a&lt;BR /&gt;UNAME=a&lt;BR /&gt;+ echo a&lt;BR /&gt;a&lt;BR /&gt;+ read SURNAME FIRSTNAME&lt;BR /&gt;+ cut -c1-5&lt;BR /&gt;+ echoAnderson&lt;BR /&gt;createuname.sh[3]: echoAnderson:  not found.&lt;BR /&gt;+ typeset -l SNAME=&lt;BR /&gt;+ [ 0 -lt 5 ]&lt;BR /&gt;+ SNAME=a&lt;BR /&gt;+ cut -c1&lt;BR /&gt;+ typeset -l FNAME=Jean&lt;BR /&gt;+ + echo a&lt;BR /&gt;UNAME=a&lt;BR /&gt;+ echo a&lt;BR /&gt;a&lt;BR /&gt;+ read SURNAME FIRSTNAME&lt;BR /&gt;+ cut -c1-5&lt;BR /&gt;+ echoAnderson&lt;BR /&gt;</description>
      <pubDate>Fri, 11 Nov 2005 06:47:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-query/m-p/4940016#M797684</guid>
      <dc:creator>Ravinder Singh Gill</dc:creator>
      <dc:date>2005-11-11T06:47:53Z</dc:date>
    </item>
    <item>
      <title>Re: script query</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-query/m-p/4940017#M797685</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I think you are missing af space in between echo and a variable name in this line:&lt;BR /&gt;&lt;BR /&gt;echo $SURNAME &lt;BR /&gt;&lt;BR /&gt;regards,&lt;BR /&gt;John K.</description>
      <pubDate>Fri, 11 Nov 2005 07:47:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-query/m-p/4940017#M797685</guid>
      <dc:creator>john korterman</dc:creator>
      <dc:date>2005-11-11T07:47:26Z</dc:date>
    </item>
    <item>
      <title>Re: script query</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-query/m-p/4940018#M797686</link>
      <description>thanks hth &amp;amp; John, that has solved half of my problem.&lt;BR /&gt;&lt;BR /&gt;I am now getting the first five letters of their surname (all in lowercase as required) but their first initial is not being appended ie i am getting an output of adams rather then adamsc etc. &lt;BR /&gt;&lt;BR /&gt;Any suggestions?</description>
      <pubDate>Fri, 11 Nov 2005 07:57:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-query/m-p/4940018#M797686</guid>
      <dc:creator>Ravinder Singh Gill</dc:creator>
      <dc:date>2005-11-11T07:57:28Z</dc:date>
    </item>
    <item>
      <title>Re: script query</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-query/m-p/4940019#M797687</link>
      <description>One possible alternative solution in perl:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;$perl -pe '($s,$f)=split; $_=substr(lc($s)."aaaa",0,5) . substr($f,0,1) . "\n"'  x.txt&lt;BR /&gt;&lt;BR /&gt;---gives---&lt;BR /&gt;aapjen&lt;BR /&gt;miesjt&lt;BR /&gt;vuuraz&lt;BR /&gt;jetjek&lt;BR /&gt;&lt;BR /&gt;--- from x.txt ----&lt;BR /&gt;aapjes noot&lt;BR /&gt;MIEsje teun&lt;BR /&gt;vuur zus&lt;BR /&gt;jetje kees&lt;BR /&gt;&lt;BR /&gt;fwiw,&lt;BR /&gt;Hein.&lt;BR /&gt;</description>
      <pubDate>Fri, 11 Nov 2005 08:08:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-query/m-p/4940019#M797687</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2005-11-11T08:08:45Z</dc:date>
    </item>
    <item>
      <title>Re: script query</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-query/m-p/4940020#M797688</link>
      <description>Hi again,&lt;BR /&gt;&lt;BR /&gt;Muthukumar's code works allright on my system, e.g. if the content of file1 is &lt;BR /&gt;Gill Ravinder&lt;BR /&gt;the script outputs&lt;BR /&gt;gillar&lt;BR /&gt;&lt;BR /&gt;check variable spelling...&lt;BR /&gt;&lt;BR /&gt;regards,&lt;BR /&gt;John K.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 11 Nov 2005 08:34:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-query/m-p/4940020#M797688</guid>
      <dc:creator>john korterman</dc:creator>
      <dc:date>2005-11-11T08:34:29Z</dc:date>
    </item>
    <item>
      <title>Re: script query</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-query/m-p/4940021#M797689</link>
      <description>Thanks guys I realised my mistake. Just one more thing. One of the Surnames is only three characters long and this only appended "a" to the surname once, hence uname was only 5 characters long rather then 6. How would I amend the loop to fix this?</description>
      <pubDate>Fri, 11 Nov 2005 08:51:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-query/m-p/4940021#M797689</guid>
      <dc:creator>Ravinder Singh Gill</dc:creator>
      <dc:date>2005-11-11T08:51:26Z</dc:date>
    </item>
    <item>
      <title>Re: script query</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-query/m-p/4940022#M797690</link>
      <description>Guys thanks for your help. I just replaced the if loop with a while loop and it works fine.</description>
      <pubDate>Fri, 11 Nov 2005 09:19:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-query/m-p/4940022#M797690</guid>
      <dc:creator>Ravinder Singh Gill</dc:creator>
      <dc:date>2005-11-11T09:19:00Z</dc:date>
    </item>
    <item>
      <title>Re: script query</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-query/m-p/4940023#M797691</link>
      <description>Guys thanks for your help. I just replaced the if loop with a while loop and it works fine.</description>
      <pubDate>Fri, 11 Nov 2005 09:19:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-query/m-p/4940023#M797691</guid>
      <dc:creator>Ravinder Singh Gill</dc:creator>
      <dc:date>2005-11-11T09:19:44Z</dc:date>
    </item>
  </channel>
</rss>

