- Community Home
- >
- Servers and Operating Systems
- >
- Legacy
- >
- Operating System - Tru64 Unix
- >
- Re: Please let me know you comments on it.
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
тАО10-16-2008 04:12 AM
тАО10-16-2008 04:12 AM
Part of Current script :-
------------------------------
set -A TELNET_HOST_ARR ${telnet_host_str}
where ${telnet_host_str} contains list of hostnames.
Like telnet_host_str="alden biddy groucho"
echo ${telnet_host_str} | grep $target_system > /dev/null
where target_system="groucho"<---hostname of one machine
==============================================
Enhance script to be done is:-
---------------------------------------
set -A TELNET_HOST_ARR ${telnet_host_str}
where ${telnet_host_str} contains list of hostnames (or) ipaddress.
Like telnet_host_str="15.146.230.65 biddy 15.146.230.119"
Please have a look at my proposed solution below and let me know your valuable review comments.
Solution:
=======
ipaddress=$(nslookup ${target_system} |grep -p ${target_system} | grep Addre
ss | awk '{print $2}')
echo ${telnet_host_str} || (grep $target_system && grep $ipaddress) > /dev/n
ull
Thanks in Advance,
Shammer.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-18-2008 03:10 AM
тАО10-18-2008 03:10 AM
Re: Please let me know you comments on it.
Can you please explain in words, rather than code, what you are trying to achieve...
Cheers,
Rob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-19-2008 09:09 PM
тАО10-19-2008 09:09 PM
Re: Please let me know you comments on it.
I must compare "telnet_host_str"contents either with ipaddress or hostnames of machines.
Where telnet_host_str is an array which contains ipaddress or hostnames of machines.
For doing comparison i did below way:
set -A TELNET_HOST_ARR ${telnet_host_str}
ipaddress=$(nslookup ${target_system} |grep -p ${target_system} | grep Addre
ss | awk '{print $2}')
echo ${telnet_host_str} || (grep $target_system && grep $ipaddress) > /dev/n
ull
Please let me know if you have better solution.
Hope you understood..
Thanks in Advance,
Shammer.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-20-2008 05:11 AM
тАО10-20-2008 05:11 AM
Re: Please let me know you comments on it.
target_system=groucho
ipaddress="15.146.230.119"
set -A TELNET_HOST_ARR ${telnet_host_str}
Below are the list of contents present in $(telnet_host_str}:-
alden baknblak beggar biddy billion bingo bobcat bogey bradford bulldogs cos curly cyberstorm diamond dimaggi
o diverdown drooper dry ds10-1 ds10-2 ds10-3 ds10-4 hyd hel lit ber bor car nitoxy es40-1 es40-2 es40-3 es40-4 fall fleegle frigate aramis geezer gehrig getwings harp highway holein1 karloff killington larry magilla madhattr porthos million athos moe moronica mullins 15.146.231.62 ogee phantoms porcupine puddinhead reptile rhinos rinse rocks scoobydoo seawitch sine whale shemp snorky spring standish stoogeshsg sugarloaf summer tan topsail toys twldee twldum vanhal1 vanhal2 vanitya veena viola voltage wash waterville whomade winter yodel toolbox hoho humphry rose fold stooges2hsg stowe 15.146.230.119 harpo 15.146.230.90 15.146.230.205 north south east west square circle triangle rectangle oval heart crescent convex
Now I want to grep for this ipaddress "15.146.230.119".
echo ${telnet_host_str} || (grep $target_system && grep $ipaddress)
Please let me know,is that right way??
Thanks,
Shammer.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-20-2008 12:05 PM
тАО10-20-2008 12:05 PM
Re: Please let me know you comments on it.
What output are you expecting to get ?
What are you going to do with it, once you've got it ?
If you can provide us with some background as to what the rest of the code is doing, rather than just this snippet it might help me and others to fill in the blanks.
Cheers,
Rob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-20-2008 08:48 PM
тАО10-20-2008 08:48 PM
Re: Please let me know you comments on it.
Consider that their is an array that contains 50 elements in it separated with spaces in between each element.
For displaying those array elements,i am using echo command( echo $telnet_host_str).
The output of this command is pasted in my previous update.
And assigning target_system="groucho"
Getting ipaddress of above target_system by nslookup command as below:
ipaddress=$(nslookup ${target_system} |grep -p ${target_system} | grep Address | awk '{print $2}')
Now my intention is to get the value either target_system or ipaddress by comparing with the output of "echo $telnet_host_str" in status variable as shown below:-
Please correct the below code properly..
status=$((echo $telnet_host_str | (grep $target_system || grep $ipaddress))
And obtained status variable is used by rest of the code.
Please let me know if this is not clear to you..
Thanks a lot for spending time on this..
Thanks,
Shammer.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-21-2008 12:35 AM
тАО10-21-2008 12:35 AM
Solutionstatus=$((echo $telnet_host_str | (grep $target_system || grep $ipaddress))
I'm not sure why you want to use $(( )). That's for arithmetic evaluation. If you want OR you need to use:
status=$(echo $telnet_host_str | grep -e $target_system -e $ipaddress)
That looks for either $target_system OR $ipaddress or both.
Note the value of $status will be either an empty string or a copy of $telnet_host_str. If you just want it to be 0 for true, you can use:
echo $telnet_host_str | grep -q -e $target_system -e $ipaddress
status=$?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-21-2008 02:59 AM
тАО10-21-2008 02:59 AM
Re: Please let me know you comments on it.
That's the answer i needed..
Thanks,
Shammer.