- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- awk or something else
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
09-19-2006 02:18 PM
09-19-2006 02:18 PM
Re: awk or something else
Now I see that all solutions work.
And one more question.
How can I get only SessionID of EP2 as output?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2006 03:04 PM
09-19-2006 03:04 PM
Re: awk or something else
Slightly differently written:
#awk '/^Ses/{l=$0} /^Bac.*: EP2/{print l; print}' x.tmp
SessionID : 2006/09/16-2
Backup Specification: EP2
SessionID : 2006/09/17-2
Backup Specification: EP2
Insert "\n" in print lines as needed.
Using perl it looks much the same:
#perl -ne '$l = $_ if /^Ses/; print $l,$_ if /^Bac.*: EP2/' x.tmp
SessionID : 2006/09/16-2
Backup Specification: EP2
SessionID : 2006/09/17-2
Backup Specification: EP2
Both solution remember any line starting with Ses..
Then they print the last one remembered, and the current line if the current line starts with Bac... and has EP2 in it.
Cheers,
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2006 03:10 PM
09-19-2006 03:10 PM
Re: awk or something else
2006/09/16-2
2006/09/17-2
as output.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2006 04:08 PM
09-19-2006 04:08 PM
Re: awk or something else
awk '/^Ses/{x=$3} /^Bac.*EP2/{print x}' infile
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2006 12:08 AM
09-20-2006 12:08 AM
Re: awk or something else
if you need to extract information for a specific session only:
omnidb -session -user root -last 3 -type backup -detail |
awk -v myid=EP2 '$1 == "SessionID" {id=$NF}
/Backup Specification/ {if (id==myid) print id,$NF}'
mfG Peter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2006 05:34 AM
09-20-2006 05:34 AM
Re: awk or something else
>2006/09/16-2
>2006/09/17-2
>as output.
slight modification to the awk command will give you just that:
# awk '{if($0~"EP2") print l; l=$NF}' infile
~cheers
- « Previous
-
- 1
- 2
- Next »