- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Menu script help
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2001 08:02 AM
11-16-2001 08:02 AM
server1
server2
server3
server4
server5
server6
into:
##########################################
Which Server would you like to administer?
server1 server2 server3
server4 server5 server6
##########################################
or:
##########################################
Which Server would you like to administer?
server1 server3 server5
server2 server4 server6
##########################################
Thanks again,
Greg
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2001 08:08 AM
11-16-2001 08:08 AM
SolutionYou can use paste. For your example file of
server1
server2
server3
server4
server5
server6
typing
cat file | paste - - -
will output
server1 server2 server3
server4 server5 server6
Note you use 1 "-" for each column required
Hope this is helpful,
John
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2001 08:09 AM
11-16-2001 08:09 AM
Re: Menu script help
You can use 'paste':
Consider this:
# echo "1\n2\n3\n4\n5\n6"| paste - - -
...will return:
1 2 3
4 5 6
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2001 08:11 AM
11-16-2001 08:11 AM
Re: Menu script help
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.
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.
Looking forward to assisting you,
Rit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2001 08:17 AM
11-16-2001 08:17 AM
Re: Menu script help
# aaa = File name of list of servers
# linelimit = words per line
cat /tmp/aaa |
awk -v linelimit=3 'BEGIN { cntr=0 } { cntr=cntr+1; printf("%s ", $1) }
cntr == linelimit { printf("\n"); cntr=0 } END { print }'
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.
Share and enjoy! Ian
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-18-2001 02:28 PM
11-18-2001 02:28 PM
Re: Menu script help
e.g.
echo "which server would you ...."
echo "*......"
pr -3t yourfilename
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.
This deals with different length strings & strings with spaces in them quite gracefully.
Hope this helps.
Rob.