- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: some help needed for scripting
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
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
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-17-2012 09:56 PM
01-17-2012 09:56 PM
Hi ,
pfa my file which contains many jobs.
my reqmnt is to print all o/p from SY3100 . i.e start and end timings .
it also must print only single entries and no duplicate entries.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2012 10:17 PM - edited 01-18-2012 12:34 PM
01-17-2012 10:17 PM - edited 01-18-2012 12:34 PM
Re: some help needed for scripting
It appears you can just use grep: grep SY3100 file
I only see the Start and End lines, no duplicates to handle.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2012 02:47 AM
01-18-2012 02:47 AM
Re: some help needed for scripting
Hi:
$ grep SY3100 smartlog.20120117 | uniq -n
rgs
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2012 06:34 AM
01-18-2012 06:34 AM
Re: some help needed for scripting
try this :
grep SY3100 FILENAME |awk '/Start|End/ { {printf "%s : %s %s %s %s %s %s ",$2,$6,$7,$8,$9,$10,$11 } ; if ( $2 == "End") {printf "\n" } }' |sort -u
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2012 11:34 PM
01-18-2012 11:34 PM
Re: some help needed for scripting
Hi guys,
Really sorry for not making my reqmnt clean.
i want to grep start and end timings from this file along with jobs name for ex sy3100
it shold give me o/p like, it sould subtract timings
job name time taken
sy3100 20 min
Also if i have multistreams A,B,C,D it should display the max time taken for that job.
- Tags:
- date arithmetic
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-19-2012 12:48 PM
01-19-2012 12:48 PM
Re: some help needed for scripting
>I want to grep start and end timings from this file along with jobs name for ex sy3100
>sy3100 20 min
Do you want it to do ALL jobs in the file or just the one selected?
>if I have multistreams A,B,C,D it should display the max time taken for that job.
What do you mean by "multistreams"?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-19-2012 10:42 PM
01-19-2012 10:42 PM
Re: some help needed for scripting
Hi Dennis ,
PFA file from which i want all jobs, after this specific job SY3100 with total time taken
i.e end time - start time .
the o/p should be like ;
SY3100 0 sec/min
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2012 01:01 AM
01-25-2012 01:01 AM
Re: some help needed for scripting
Hi Dennis ,
I hope my reqmnt is clear now.
i just need a hint to subtract time.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2012 09:33 PM
01-25-2012 09:33 PM
Re: some help needed for scripting
>I hope my requirement is clear now.
I still don't know what multistreams are?
>I just need a hint to subtract time.
# subtract times
# Tue Jan 17 21:56:18 IST 2012 End: Tue Jan 17 21:56:18 IST 2012
grep sy3100 smartlog.20120117.txt |
awk '
# day of month, HH:MM:SS (24 hour clock)
function convert_to_secs(day, hhmmss) {
# print day, hhmmss
split(hhmmss, t_hhmmss, ":")
return (((day - 1) * 24 + t_hhmmss[1]) * 60 + t_hhmmss[2]) * 60 + t_hhmmss[3]
}
BEGIN {
print "job name time"
}
$2 == "Start" {
yyyymmmddzz[$4] = $7 $11 $10 # check for unhandled date straddling
start_time[$4] = convert_to_secs($8, $9)
next
}
$2 == "End" {
if (yyyymmmddzz[$4] == "") {
print "Cannot find Start time for", $4
next
}
stop_yyyymmmddzz = $7 $11 $10 # check for unhandled date straddling
if (stop_yyyymmmddzz != yyyymmmddzz[$4]) {
print "Start/stop for", $4", straddles complex date boundary", stop_yyyymmmddzz
}
stop_time = convert_to_secs($8, $9)
# printf "%s: %d\n", $4, start_time[$4]
# printf "%s: %d\n", $4, stop_time
printf "%-12s %.1f min\n", $4, (stop_time - start_time[$4]) / 60
next
}'
This doesn't handle the case where the times span month boundaries. It does detect it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-26-2012 11:13 PM
01-26-2012 11:13 PM
Re: some help needed for scripting
Hi Dennis ,
After grepping the required pattern from logfile m getting ;
GB_PROD /home//sysout > grep "IN0800" smartlog.??????.txt
*** Start of IN0800A at Mon Nov 28 15:21:22 IST 2011
*** End of IN0800A at Mon Nov 28 15:21:24 IST 2011 - RC = 0
*** Start of IN0800B at Mon Nov 28 15:21:27 IST 2011
*** End of IN0800B at Mon Nov 28 15:21:29 IST 2011 - RC = 0
*** Start of IN0800C at Mon Nov 28 15:21:32 IST 2011
*** End of IN0800C at Mon Nov 28 15:21:33 IST 2011 - RC = 0
*** Start of IN0800D at Mon Nov 28 15:21:37 IST 2011
*** End of IN0800D at Mon Nov 28 15:21:38 IST 2011 - RC = 0
*** Start of IN0800E at Mon Nov 28 15:21:42 IST 2011
*** End of IN0800E at Mon Nov 28 15:21:44 IST 2011 - RC = 0
*** Start of IN0800F at Mon Nov 28 15:21:47 IST 2011
*** End of IN0800F at Mon Nov 28 15:21:48 IST 2011 - RC = 0
*** Start of IN0800G at Mon Nov 28 15:21:52 IST 2011
*** End of IN0800G at Mon Nov 28 15:21:53 IST 2011 - RC = 0
*** Start of IN0800H at Mon Nov 28 15:21:57 IST 2011
*** End of IN0800H at Mon Nov 28 15:21:58 IST 2011 - RC = 0
==========================================================
I tried running that time function ;
i got o/p as ;
job name time
IN0800A 0.0 min
IN0800B 0.0 min
IN0800C 0.0 min
IN0800D 0.0 min
IN0800E 0.0 min
IN0800F 0.0 min
IN0800G 0.0 min
IN0800H 0.0 min
I understand some column paramters needs to be edited ,new to scripting .
Any more help would be great.
Thanks .