- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- grep on snmp collected data
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-17-2003 05:06 AM
11-17-2003 05:06 AM
I have a huge ascii text file with data collection point. the text file is of the form(below)
How could I use grep/awk to grep for data between a time frame
In Kbits R1 6/1.10 3/105 to R2 31/10/03 10:15:00 3657.07
In Kbits R1 6/1.10 3/105 to R2 31/10/03 10:20:00 3976.85
In Kbits R1 6/1.10 3/105 to R2 31/10/03 10:25:00 5088.18
In Kbits R1 6/1.10 3/105 to R2 31/10/03 11:00:00 3471.26
In Kbits R1 6/1.10 3/105 to R2 31/10/03 11:05:00 4311.4
In Kbits R1 6/1.10 3/105 to R2 31/10/03 11:10:00 2000.9
In Kbits R1 6/1.10 3/105 to R2 31/10/03 12:50:00 3021.64
In Kbits R1 6/1.10 3/105 to R2 31/10/03 12:55:00 3385.86
In Kbits R1 6/1.10 3/105 to R2 31/10/03 13:00:00 3483.98
In Kbits R1 6/1.10 3/105 to R2 31/10/03 13:05:00 3920.98
In Kbits FR1 6/1.10 3/105 to R2 31/10/03 14:00:00 5627.66
In Kbits R1 6/1.10 3/105 to R2 31/10/03 14:05:00 5252.07
In Kbits R1 6/1.10 3/105 to R2 31/10/03 14:10:00 3768.24
I can use awk and grep to get required columns and to get data for a set date but I dont know how to grep for data for between time frames in a day.
From the week data to get all data for a certain date i usually use
$ grep '^03/.*/2003'
BUT If I would like to see all data within a week between 10am and 14pm how can I do this?
Can someone please help as I think have tried everything to my knowledge and understanding
Any help will be greatly appreciated
regards,
gab
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-17-2003 05:09 AM
11-17-2003 05:09 AM
Re: grep on snmp collected data
I'm attaching the "Handy One Liners for Sed". I think the "# print section of file between two regular expressions (inclusive)" one liner might be just the ticket for you.
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-17-2003 05:51 AM
11-17-2003 05:51 AM
Solutionmaybe you have already tried this simple approach: if you have the exact time specifications you can specify begin and end time, e.g. like this:
# awk '/31\/10\/03\ 10:15:00/,/31\/10\/03\ 14:00:00/' <./infile
which will print the lines from 31/10/03 between 10:00 and 14:00. However, it will of course only work if both the exact begin and end specifications are present.
regards,
John K.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-17-2003 06:05 AM
11-17-2003 06:05 AM
Re: grep on snmp collected data
awk -v D="31/10/03" -v T1="10:20:00" -v T2="13:00:00" 'BEGIN{p=0};$9 >= T1{p=D};$9 <= T2{p=0};{if (D == $8) print $0}'
Set variables D,T1,T2 to the values you are searching.
HTH
-- Rod Hills
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-17-2003 08:41 PM
11-17-2003 08:41 PM
Re: grep on snmp collected data
It worked like a charm. Thanks Pete on the sed document. I shall start to digest this.
regards,
gab