- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- script tp pull data from a log file ?
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
тАО07-02-2004 06:27 AM
тАО07-02-2004 06:27 AM
*****************************************
HP-UX B.11.11 9000/800/N4000-75
*****************************************
Does anyone know a way to get certain information from a log file, and place it into
another file ( maybe "sed" ).
example :
************************************
I have two log files I generate,
1) "memrpt.log" which simply is the output from "vmstat" command @ 10sec intervals( date & vmstat -n ), which looks like:
Thu Jul 1 16:42:31 PDT 2004 ,
CPU
us sy id
1 1 98
1 1 98
1 1 98
1 1 98
1 1 98
1 1 98
Thu Jul 1 16:42:41 PDT 2004 ,
CPU
us sy id
1 1 98
1 1 98
1 1 98
1 1 98
1 1 98
1 1 98
Thu Jul 1 16:42:51 PDT 2004 ,
CPU
us sy id
1 1 98
1 1 98
1 1 98
1 1 98
1 1 98
1 1 98
2) "cpurpt.log" which is output from
"vmstat" command @ 10 sec intervals ( date & vmstat ) which looks like :
Thu Jul 1 16:42:30 PDT 2004 , Free Memory=3579MB
Thu Jul 1 16:42:40 PDT 2004 , Free Memory=3579MB
Thu Jul 1 16:42:50 PDT 2004 , Free Memory=3579MB
Thu Jul 1 16:43:00 PDT 2004 , Free Memory=3579MB
Thu Jul 1 16:43:10 PDT 2004 , Free Memory=3579MB
Thu Jul 1 16:43:20 PDT 2004 , Free Memory=3580MB
Thu Jul 1 16:43:30 PDT 2004 , Free Memory=3580MB
Thu Jul 1 16:43:40 PDT 2004 , Free Memory=3581MB
Thu Jul 1 16:43:50 PDT 2004 , Free Memory=3579MB
Thu Jul 1 16:44:00 PDT 2004 , Free Memory=3579MB
*****************************************
These reports might run over 23 hours ( ex: 18:00 to 17:00 ), but I need to be able to pull certain time periods from these reports
(ex: 22:00 to 02:00 ). I have seen in "sar"
where it can have "start" & "end" time, and
deliver a report for just the requested time period. Right now I have to "vi" about 20 files
just deliver certain time periods. I would like to automate this process. If you know a way to do this, thanks. I'm reviewing some "sed" commands now.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-02-2004 06:34 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-02-2004 06:56 AM
тАО07-02-2004 06:56 AM
Re: script tp pull data from a log file ?
How about this
START=$1
END=$2
LOG=/tmp/memrpt
sed -n "/ $START:/,/ $END:/p" $LOG
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-02-2004 07:58 AM
тАО07-02-2004 07:58 AM
Re: script tp pull data from a log file ?
I am attaching a small script that I whipped up for the purpose. It is not bullet proof and not an absolute solution as well as not being tested due to the lack of data files. But the general idea is pretty simple and understandable.
Hope this helps.
UNIX because I majored in cryptology...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-02-2004 08:19 AM
тАО07-02-2004 08:19 AM
Re: script tp pull data from a log file ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-02-2004 08:42 AM
тАО07-02-2004 08:42 AM
Re: script tp pull data from a log file ?
this will print ALL lines from the first instance of 21:00 until it reaches 23:00 so
20:00
21:00
22:00
23:00
24:00
00:00
so the above would retutn
21:00
22:00
23:00
HTH
Tim