<?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: Menu script help in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/menu-script-help/m-p/2615671#M37495</link>
    <description>Hi Greg,&lt;BR /&gt;&lt;BR /&gt;What you want to do is write a script using a case statement. Within your case statement you can define with maybe some if statements on the response what tasks you want done; then you close your case statement with esacs and done.  I generally preface mine with a trap statement that as long as the result is true...run my case statement otherwise exit.&lt;BR /&gt;&lt;BR /&gt;You will notice I did not write the script for you...if you would like to begin the script I'll be happy to edit and make suggestions....BUT you will never learn to write scripts if you don't start.&lt;BR /&gt;&lt;BR /&gt;Looking forward to assisting you,&lt;BR /&gt;Rit</description>
    <pubDate>Fri, 16 Nov 2001 16:11:06 GMT</pubDate>
    <dc:creator>Rita C Workman</dc:creator>
    <dc:date>2001-11-16T16:11:06Z</dc:date>
    <item>
      <title>Menu script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/menu-script-help/m-p/2615668#M37492</link>
      <description>At one time, I thought I remembered someone referencing a command on this forum that could output a list into columns.  For instance, if I had a file listing our servers and wanted to create a menu for the helpdesk, how could I output&lt;BR /&gt;&lt;BR /&gt;server1&lt;BR /&gt;server2&lt;BR /&gt;server3&lt;BR /&gt;server4&lt;BR /&gt;server5&lt;BR /&gt;server6&lt;BR /&gt;&lt;BR /&gt;into:&lt;BR /&gt;##########################################&lt;BR /&gt;Which Server would you like to administer?&lt;BR /&gt;server1       server2      server3&lt;BR /&gt;server4       server5      server6&lt;BR /&gt;##########################################&lt;BR /&gt;&lt;BR /&gt;or:&lt;BR /&gt;##########################################&lt;BR /&gt;Which Server would you like to administer?&lt;BR /&gt;server1       server3      server5&lt;BR /&gt;server2       server4      server6&lt;BR /&gt;##########################################&lt;BR /&gt;&lt;BR /&gt;Thanks again,&lt;BR /&gt;Greg</description>
      <pubDate>Fri, 16 Nov 2001 16:02:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/menu-script-help/m-p/2615668#M37492</guid>
      <dc:creator>Greg Stark_1</dc:creator>
      <dc:date>2001-11-16T16:02:23Z</dc:date>
    </item>
    <item>
      <title>Re: Menu script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/menu-script-help/m-p/2615669#M37493</link>
      <description>Hi Greg,&lt;BR /&gt;&lt;BR /&gt;You can use paste. For your example file of &lt;BR /&gt;&lt;BR /&gt;server1&lt;BR /&gt;server2&lt;BR /&gt;server3&lt;BR /&gt;server4&lt;BR /&gt;server5&lt;BR /&gt;server6&lt;BR /&gt;&lt;BR /&gt;typing &lt;BR /&gt;cat file | paste - - -&lt;BR /&gt;&lt;BR /&gt;will output &lt;BR /&gt;server1   server2   server3&lt;BR /&gt;server4   server5   server6&lt;BR /&gt;&lt;BR /&gt;Note you use 1 "-" for each column required&lt;BR /&gt;&lt;BR /&gt;Hope this is helpful,&lt;BR /&gt;&lt;BR /&gt;John&lt;BR /&gt;</description>
      <pubDate>Fri, 16 Nov 2001 16:08:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/menu-script-help/m-p/2615669#M37493</guid>
      <dc:creator>John Strang</dc:creator>
      <dc:date>2001-11-16T16:08:15Z</dc:date>
    </item>
    <item>
      <title>Re: Menu script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/menu-script-help/m-p/2615670#M37494</link>
      <description>Hi Greg:&lt;BR /&gt;&lt;BR /&gt;You can use 'paste':&lt;BR /&gt;&lt;BR /&gt;Consider this:&lt;BR /&gt;&lt;BR /&gt;# echo "1\n2\n3\n4\n5\n6"| paste - - -&lt;BR /&gt;&lt;BR /&gt;...will return:&lt;BR /&gt;&lt;BR /&gt;1       2       3&lt;BR /&gt;4       5       6&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Fri, 16 Nov 2001 16:09:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/menu-script-help/m-p/2615670#M37494</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2001-11-16T16:09:05Z</dc:date>
    </item>
    <item>
      <title>Re: Menu script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/menu-script-help/m-p/2615671#M37495</link>
      <description>Hi Greg,&lt;BR /&gt;&lt;BR /&gt;What you want to do is write a script using a case statement. Within your case statement you can define with maybe some if statements on the response what tasks you want done; then you close your case statement with esacs and done.  I generally preface mine with a trap statement that as long as the result is true...run my case statement otherwise exit.&lt;BR /&gt;&lt;BR /&gt;You will notice I did not write the script for you...if you would like to begin the script I'll be happy to edit and make suggestions....BUT you will never learn to write scripts if you don't start.&lt;BR /&gt;&lt;BR /&gt;Looking forward to assisting you,&lt;BR /&gt;Rit</description>
      <pubDate>Fri, 16 Nov 2001 16:11:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/menu-script-help/m-p/2615671#M37495</guid>
      <dc:creator>Rita C Workman</dc:creator>
      <dc:date>2001-11-16T16:11:06Z</dc:date>
    </item>
    <item>
      <title>Re: Menu script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/menu-script-help/m-p/2615672#M37496</link>
      <description>Why not use the mighty 'awk'?&lt;BR /&gt;&lt;BR /&gt;# aaa = File name of list of servers&lt;BR /&gt;# linelimit = words per line&lt;BR /&gt;cat /tmp/aaa |&lt;BR /&gt;awk -v linelimit=3 'BEGIN { cntr=0 } { cntr=cntr+1; printf("%s ", $1) }&lt;BR /&gt;cntr == linelimit { printf("\n"); cntr=0 } END { print }'&lt;BR /&gt;&lt;BR /&gt;This does not handle the one scenario when the number of items is even divisible by the linelimit, which will produce a blank line at the end. &lt;BR /&gt;&lt;BR /&gt;Share and enjoy! Ian</description>
      <pubDate>Fri, 16 Nov 2001 16:17:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/menu-script-help/m-p/2615672#M37496</guid>
      <dc:creator>Ian Dennison_1</dc:creator>
      <dc:date>2001-11-16T16:17:32Z</dc:date>
    </item>
    <item>
      <title>Re: Menu script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/menu-script-help/m-p/2615673#M37497</link>
      <description>Use the 'pr' command which is designed for this job&lt;BR /&gt;&lt;BR /&gt;e.g.&lt;BR /&gt;&lt;BR /&gt;echo "which server would you ...."&lt;BR /&gt;echo "*......"&lt;BR /&gt;pr -3t yourfilename&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Where the file 'yourfilename' is a list of the items you want in the menu and -3 is the number of columns you want i.e -5 would list this in 5 columns.&lt;BR /&gt;&lt;BR /&gt;This deals with different length strings &amp;amp; strings with spaces in them quite gracefully.&lt;BR /&gt;&lt;BR /&gt;Hope this helps.&lt;BR /&gt;Rob.</description>
      <pubDate>Sun, 18 Nov 2001 22:28:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/menu-script-help/m-p/2615673#M37497</guid>
      <dc:creator>Rob Galloway_1</dc:creator>
      <dc:date>2001-11-18T22:28:00Z</dc:date>
    </item>
  </channel>
</rss>

