- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Problem on scripting.
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
Discussions
Discussions
Forums
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
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
тАО09-06-2001 12:09 AM
тАО09-06-2001 12:09 AM
My script is something like below:
FunctionA ()
{
{
promon DB1 <<-EOF | grep "data"
1
2
q
q
EOF
} > file1
}
And the output is something like this:
Menu:
1. xxxx
2. xxxx
3. xxxx
q. exit
Choice:
I had tried to use "1> /dev/null" in some places but failed to get the data.
Hope you guys can help me.
Thanks very much.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-06-2001 12:16 AM
тАО09-06-2001 12:16 AM
Re: Problem on scripting.
Why don't you grep out the MENU from the file after it has got generated, like
grep -v "MENU" file.lst > file.lst.tmp
mv file.lst.tmp file.lst
...BPK...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-06-2001 12:28 AM
тАО09-06-2001 12:28 AM
Re: Problem on scripting.
I had tried to generate the whole things (menu and data) to a file and then grep the necessary data but still failed.
I had modified the script to:
FunctionA ()
{
{
promon DB1 <<-EOF
1
2
q
q
EOF
} > file1
}
grep "data" file1
However, it still shows the menu in the screen together with the "data".
Actually I want to make the menu not showing in the screen and only shows the "data".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-06-2001 12:33 AM
тАО09-06-2001 12:33 AM
Re: Problem on scripting.
Use grep -v "MENU" to remove the menu., redirect in into a file...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-06-2001 12:39 AM
тАО09-06-2001 12:39 AM
Re: Problem on scripting.
Sorry that I did not state myself clear. Actually I want to make the menu NOT showing on the screen but only show the "data". I had tried your method but it still shows the menu on the screen even I tried to add "grep -v MENU". Do you have any other methods that can tell me??
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-06-2001 12:50 AM
тАО09-06-2001 12:50 AM
Solutionit is possible, that the promon program outputs the menu to the STDERR file descriptor (2) and not to the STDOUT (1). To discard the output on STDERR redirect in this way:
...
} 2>/dev/null 1>file
I assume (because of the grep "data") that all output lines you want to see contain the text "data" somewhere.
You could make the selectivity more accurate, if you knew, that the text appears alway at the beginning of the line (grep "^data") or at the end of the line (grep "data$").
Maybe you don't need the grep at all.
If the output cannot be separated from the menu in the described way, then a small awk script could help:
...
} |
awk '/^Choice:/ { xxx=1 }
xxx
'
Regards, Klaus
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-06-2001 01:08 AM
тАО09-06-2001 01:08 AM
Re: Problem on scripting.
Correction:
awk '/^Choice:/ { xxx=1; next }
.....
Klaus
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-06-2001 01:44 AM
тАО09-06-2001 01:44 AM
Re: Problem on scripting.
Actually your first answer had solved my problem.