Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Print events from two lines with a common identifier Post 302824653 by vanand420 on Friday 21st of June 2013 09:10:45 AM
Old 06-21-2013
Quote:
Originally Posted by vidyadhar85
try..
Code:
 
 
awk -F";" '/^alarm/{split($5,A," ");
getline;
split($5,B," ");
split(A[2],C,":");
split(B[2],D,":");
E=(D[1]*60*60+D[2]*60+D[3])-(C[1]*60*60+C[2]*60+C[3]);
{if(E>59){print "Alarm ID"$6" clearded in "(E%3600)/60" minutes"}else{print "Alarm ID"$6" clearded in "E" seconds"}}}' filename

Thanks Man!! It worked like a rocket..perfect..!!
Made few changes to script i.e. added sort -t ';' -k6 {to sort the common identifier in order means alarm then corresponding clearAlarm else alarm and corresponding ClearAlarm are most of the times far in file, not next line}

How this script would react if a alarm is not clear i.e it does not have a clearAlarm event? What has to be modified in it..

Thanks for your support!!
This User Gave Thanks to vanand420 For This Post:
 

8 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

COMMON_ROOT=/files/common: is not an identifier

hi, i am getting this error while executing the script with cron:- COMMON_ROOT=/files/common: is not an identifier Manual run is ok, not getting any error. (2 Replies)
Discussion started by: nitinmoriwal
2 Replies

2. UNIX for Advanced & Expert Users

how to take out common of two lines in a file

I use sed and awk. I am not a big expert but to some extent. I have file like this PFA0165c ctg_6843 PFA0335w ctg_6843 ctg_6871 ctg_6977 ctg_6654 ctg_7052 ctg_6899 ctg_6840 ctg_7202 ctg_6638 PFA0155c ctg_6877 ctg_7169 ctg_7179 ctg_6843 ctg_6871 Now I want output like... (6 Replies)
Discussion started by: jam_ali49
6 Replies

3. Shell Programming and Scripting

Common lines from files

Hello guys, I need a script to get the common lines from two files with a criteria that if the first two columns match then I keep the maximum value of the 3rd column.(tab separated columns) Sample input: file1: 111 222 0.1 333 444 0.5 555 666 0.4 file 2: 111 222 0.7 555 666... (5 Replies)
Discussion started by: jaysean
5 Replies

4. Shell Programming and Scripting

print lines AFTER lines cointaining a regexp (or print every first and fourth line)

Hi all, This should be very easy but I can't figure it out... I have a file that looks like this: @SRR057408.1 FW8Y5CK02R652T length=34 AGCAGTGGTATCAACGCAGAGTAAGCAGTGGTAT +SRR057408.1 FW8Y5CK02R652T length=34 FIIHFF6666?=:88@@@BBD:::?@ABBAAA>8 @SRR057408.2 FW8Y5CK02TBMHV length=52... (1 Reply)
Discussion started by: kmkocot
1 Replies

5. Shell Programming and Scripting

Common lines from files

Hello guys, I need a script to get the common lines from two files with a criteria that if the first two columns match then I keep the maximum value of the 5th column.(tab separated columns) . 3rd and 4th columns corresponds to the row which has highest value for the 5th column. Sample... (2 Replies)
Discussion started by: jaysean
2 Replies

6. Shell Programming and Scripting

Find common numbers and print yes or no

Hi I have 2 files with following data First file, sp|Q676U5|A16L1_HUMAN, Autophagy-related protein 16-1 OS=Homo sapiens GN=ATG16L1 PE=1 SV=2, Maximum coiled-coil residue probability: 0.657 in position 163. Maximum dimeric residue probability: 0.288 in position 163. ... (1 Reply)
Discussion started by: manigrover
1 Replies

7. Shell Programming and Scripting

Sum column values based in common identifier in 1st column.

Hi, I have a table to be imported for R as matrix or data.frame but I first need to edit it because I've got several lines with the same identifier (1st column), so I want to sum the each column (2nd -nth) of each identifier (1st column) The input is for example, after sorted: K00001 1 1 4 3... (8 Replies)
Discussion started by: sargotrons
8 Replies

8. UNIX for Beginners Questions & Answers

Compare two files and print based on common variable value.

Hi All, i have below two files. FILE: NAME="/dev/sda" TYPE="disk" SIZE="60G" OWNER="root" GROUP="disk" MODE="brw-rw----" PKNAME="" MOUNTPOINT="" NAME="/dev/sda1" TYPE="part" SIZE="500M" OWNER="root" GROUP="disk" MODE="brw-rw----" PKNAME="/dev/sda" MOUNTPOINT="/boot" NAME="/dev/sda2"... (3 Replies)
Discussion started by: balu1234
3 Replies
hpialarms(1)							      OpenHPI							      hpialarms(1)

NAME
hpialarms - A openhpi sample application that shows "Alarm Control" management instruments SYNOPSIS
hpialarms [-D id] [-N host[:port]] [-C <cfgfile>] [-a 1|0][-b 1|0][-c 1|0][-m 1|0][-n 1|0][-p 1|0][-i n][-o][-X][-h] hpialarms [--domain=id] [--host=host[:port]] [--cfgfile=file] [--diska=1|0] [--diskb=1|0] [--critical=1|0] [--major=1|0] [--minor=1|0] [--power=1|0] [--chassisid=n] [--all] [--debug] [--help] DESCRIPTION
hpialarms walks the RPT (Resource Presence Table) for resources that have "Alarm Control" management instruments (SAHPI_CTRL_LED). If no domain or host is selected, hpialarms uses the default domain as specified in the openhpiclient.conf file. OPTIONS
(No Option) Display alarm states Help Options: -h, --help Show help options Application Options: -c 1|0, --critical=1|0 Set critical alarm on|off -m 1|0, --major=1|0 Set major alarm on|off -n 1|0, --minor=1|0 Set minor alarm on|off -a 1|0, --diska=1|0 Set diska alarm on|off -b 1|0, --diskb=1|0 Set diskb alarm on|off -p 1|0, --power=1|0 Set power alarm on|off -i n, --chassisid=n Set chassis id on for n seconds -o, --all Set all alarms off -D nn, --domain=nn Select domain id nn -X, --debug Display debug messages -N "host[:port]", --host="host[:port]" Open session to the domain served by the daemon at the specified URL (host:port). This option overrides the OPENHPI_DAEMON_HOST and OPENHPI_DAEMON_PORT environment variables. If host contains ':' (for example IPv6 address) then enclose it in square brackets. For example: "[::1]" or "[::1]:4743". -C "file", --cfgfile="file" Use passed file as client configuration file. This option overrides the OPENHPICLIENT_CONf environment variable. SAMPLE OUTPUT
hpialarmpanel ver 0.6 RptInfo: UpdateCount = 5, UpdateTime = 8a2dc6c0 rptentry[0] resourceid=1 tag: Mullins RDR[45]: ctltype=2:1 oem=0 Chassis Identify Control RDR[48]: ctltype=0:1 oem=10 Front Panel Power Alarm LED state = off RDR[51]: ctltype=0:1 oem=13 Front Panel Minor Alarm LED state = ON RDR[46]: ctltype=0:0 oem=0 Cold Reset Control RDR[49]: ctltype=0:1 oem=11 Front Panel Critical Alarm LED state = off RDR[50]: ctltype=0:1 oem=12 Front Panel Major Alarm LED state = off SEE ALSO
hpi_shell hpidomain hpigensimdata hpireset hpitop hpiel hpiinv hpisensor hpitree hpievents hpionIBMblade hpisettime hpiwdt hpifan hpipower hpithres hpixml ohdomainlist ohhandler ohparam AUTHORS
Authors of this man page: Peter D Phan (pdphan@users.sourceforge.net) Ulrich Kleber (ulikleber@users.sourceforge.net) Anton Pak (avpak@users.sourceforge.net) 3.2.1 2011-09-20 hpialarms(1)
All times are GMT -4. The time now is 10:06 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy