- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- combinig o/p
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
01-13-2010 09:25 PM
01-13-2010 09:25 PM
i wrote one script to get the node details.
#!/usr/bin/sh
#Script to check the node details
Node=$(/opt/OV/bin/ovtopodump -lr|grep "NODE LABEL"|awk '{print $3}')
Int=$(/opt/OV/bin/ovtopodump -lr|grep "NUMBER OF INTERFACES")
Detail="$Node $Int"
echo "$Detail \c\n"
_______________________________
The o/p of this command is will be
Node=$(/opt/OV/bin/ovtopodump -lr|grep "NODE LABEL"|awk '{print $3}')
xyz.co.in
yyy.co.in
sss.co.in
ttt.co.in
and o/p of second command Int=$(/opt/OV/bin/ovtopodump -lr|grep "NUMBER OF INTERFACES")
is
interfaces 30
interfaces 120
interfaces 12
interfaces 44
what is my req is i want to display the o/p in one line
i.e
xyz.co.in interfaces 30
yyy.co.in interfaces 120
sss.co.in interfaces 12
but i am getting o/p as
xyz.co.in
yyy.co.in
sss.co.in
ttt.co.in interfaces 30
interfaces 120
interfaces 12
interfaces 44
please guide me to achieve this .
Thanks to all in advance
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-13-2010 10:05 PM
01-13-2010 10:05 PM
Re: combinig o/p
paste file1 file2
outpur will be the one you want.
BR,
Kapil+
- Tags:
- paste
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-13-2010 10:22 PM
01-13-2010 10:22 PM
Re: combinig o/p
Thanks for the information.
It would be helpful if we combine the o/p without redirecting the result to another one and combibining it.
any way that was working.Thanks Once again
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-13-2010 10:32 PM
01-13-2010 10:32 PM
Re: combinig o/p
Detail= paste $Node $Int
echo "$Detail \c\n"
this should work.
BR,
Kapil+
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-13-2010 11:09 PM
01-13-2010 11:09 PM
Re: combinig o/p
It is not working, as it is not able to find the files.
Thanks & Regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-14-2010 03:01 AM
01-14-2010 03:01 AM
Re: combinig o/p
You can probably do that if you use awk on the output of:
/opt/OV/bin/ovtopodump -lr | grep -e "NODE LABEL" -e "NUMBER OF INTERFACES"
Can you provide a sample of that that looks like?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-14-2010 03:35 AM
01-14-2010 03:35 AM
Re: combinig o/p
Tech Mahindra
Data Canter Tubli Bahrain
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2010 05:42 AM
01-15-2010 05:42 AM
Re: combinig o/p
# /opt/OV/bin/ovtopodump -lr |
awk '/NODE LABEL/ {printf $3"\t"}
/NUMBER OF INTERFACES/ {print $0}'
maybe it's not perfect because it is untested. But there's no need to run ovtopodump twice and grep can also be done with awk. Tailor it to your own needs.
Unix operates with beer.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2010 07:02 PM
01-15-2010 07:02 PM
Re: combinig o/p
Assuming they come out in that order, you could also use a variable so you only have one print:
... | awk '
/NODE LABEL/ { NODE = $3 }
/NUMBER OF INTERFACES/ { print NODE, $0 }'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2010 10:44 PM
01-17-2010 10:44 PM
Re: combinig o/p
Thanks all,
can you please tell me how this command works
1. /opt/OV/bin/ovtopodump -lr|awk '/NODE LABEL/ { NODE = $3 } /NUMBER OF INTERFACES/ { print NODE, $0 }'
2.
/opt/OV/bin/ovtopodump -lr | awk '/NODE LABEL/ {printf $3"\t"}/NUMBER OF INTERFACES/ {print $0}'
It would be great helpful if you explain how this works.
Thanks a lot
both are giving the desired o/p.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2010 02:04 AM
01-18-2010 02:04 AM
Solution>1. awk '/NODE LABEL/ { NODE = $3 } /NUMBER OF INTERFACES/ { print NODE, $0 }'
This saves field3 of every line that has "NODE LABEL". When it finds a line with "NUMBER OF INTERFACES", it first prints the saved NODE, then a space (the variable OFS), then the current line.
>2.awk '/NODE LABEL/ {printf $3"\t"}/NUMBER OF INTERFACES/ {print $0}'
This finds the same two lines. For the first, it prints field3, then a tab. For the second, it prints the line, appended to the first printf (that doesn't have a newline).
Both depend on the ordering of the original two lines.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2010 02:08 AM
01-18-2010 02:08 AM
Re: combinig o/p
awk '/search_pattern/ {do this if pattern found}'
with the 'print' awk statement you can write the n'th field by $n. The fields are separated by whitespaces in default.
so the following means:
awk '/NODE LABEL/ {printf $3"\t"}
/NUMBER OF INTERFACES/ {print $0}'
if "NODE LABEL" is found in the line, print the 3rd field, and if "NUMBER OF INTERFACES" matches print the whole line (that's $0)
And do not forget about the quotes (') all around the awk statement, without these the words with $ would be substituted by your shell.
The other query is the same, I hope you can figure that out.
Unix operates with beer.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2010 02:08 AM
01-18-2010 02:08 AM