Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Output top line for each unique host Post 302993893 by Junes on Thursday 16th of March 2017 04:32:34 AM
Old 03-16-2017
Hi All,
I am using this command "bpdbjobs -most_columns | awk '!a[$3]++'"

But I noticed a slight issue.

I need to look at column $3 and $8 and if the entries are the same, then I should take the first (top) line..

I hope I have explained this correctly. Look at "sv204134" - second and third line below

If a job is still running, then command above "awk '!a[$3]++'"" is outputting job completed line - 243285912 and job still running - 243286673 and I want it to only display job still running - 243286673 and ignore (not show) job completed.

So I need to compare $3 and $8


Code:
# bpdbjobs -most_columns | sed -e "s/\,/ /g"  | awk '{ if($2=="0") print $0}' | grep -i sv20413 | awk '{print $1,$3,$7,$5,$9,$(10),$13,$6,$4}' | awk '!a[$3]++'

243286674 3 sv204135 LDN_CAM_NT_PRD_VMWARE_SQL 1489629600 0000000324 1 INC_1MTH 1
 **** 243286673 1 nbnesln1p02 INC_1MTH 0000023162 0000000000 3 sv204134 LDN_WAT_NT_PRD_VMWARE_SQL                    (Job Running - should be reported)
243286157 3 sv204133 LDN_WAT_NT_PRD_VMWARE 1489604401 0000000707 1 INC_1MTH 1
***** 243285912 3 sv204134 LDN_WAT_NT_PRD_VMWARE_SQL 1489543200 0000029480 1 INC_1MTH 1                           (Job Completed - should not be reported)

Please can you help....

Thanks

Last edited by Junes; 03-16-2017 at 06:11 AM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

top output

Hi all, below is the output of my 'top' Tasks: 91 total, 2 running, 89 sleeping, 0 stopped, 0 zombie Cpu(s): 3.9% us, 20.5% sy, 0.0% ni, 75.6% id, 0.0% wa, 0.0% hi, 0.0% si Can someone tell me what does us, sy,ni,id,wa,hi,si stands stand for? (4 Replies)
Discussion started by: new2ss
4 Replies

2. Shell Programming and Scripting

capturing output from top and format output

Hi all, I'd like to capture the output from the 'top' command to monitor my CPU and Mem utilisation.Currently my command isecho date `top -b -n1 | grep -e Cpu -e Mem` I get the output in 3 separate lines.Tue Feb 24 15:00:03 Cpu(s): 3.4% us, 8.5% sy .. .. Mem: 1011480k total, 226928k used, ....... (4 Replies)
Discussion started by: new2ss
4 Replies

3. Shell Programming and Scripting

top output for six processes with the same name, output changed from column to row

Hi, I have a system under test, and I use a script that does a ps. The output, is in the following format, it's basically the timestamp, followed by the rss and vsize. 09:03:57 68404 183656 68312 181944 69860 217360 67536 182564 69072 183172 69032 199276 09:04:27 68752 183292 70000 189020... (5 Replies)
Discussion started by: Bloke
5 Replies

4. Solaris

top output and swap -s output are differing

Solaris experts, Am struggling, and wondering for the past more than one week that, how to calculate the total available and used memory/swap space. Finally installed and used top & got some understanding, but while cross-checking, there are mismatches. Main Memory top o/p - 2GB... (7 Replies)
Discussion started by: thegeek
7 Replies

5. Shell Programming and Scripting

grep with date & unique output

alert.log has the entries with ORA-XXXX, .... Mon Sep 24 15:08:09 2012 WARNING: inbound connection timed out (ORA-3136) Mon Sep 24 15:08:09 2012 WARNING: inbound connection timed out (ORA-3136) Mon Sep 24 15:08:09 2012 WARNING: inbound connection timed out (ORA-3136) Mon Sep 24 15:15:01... (4 Replies)
Discussion started by: Daniel Gate
4 Replies

6. Shell Programming and Scripting

How to get unique of file1 from file2 and save the output?

Please help, file1.txt 1 2 3 4 5 file2.txt 3 4 5 6 7 All I need is this result.txt 1 2 (17 Replies)
Discussion started by: richmac
17 Replies

7. Shell Programming and Scripting

Output first unique record in csv file

Hi, I have to output a new csv file from an input csv file with first unique value in the first column. input csv file color product id status green 102 pass yellow 201 hold yellow 202 keep green 101 ok green 103 hold yellow 203 ... (5 Replies)
Discussion started by: Chris LAU
5 Replies

8. Solaris

Host name in front of ps output

hello All. I am working on something that should be really simply. It turns out that its not. I am trying to produce output to list the hostname along with all the current running programs. the script im using is: for PS in `ps -Ao "user,args" | cut -d' ' -f1,2` do echo "`uname -n`, $PS"... (5 Replies)
Discussion started by: busi386
5 Replies

9. Shell Programming and Scripting

Sorting out unique values from output of for loop.

Hi , i have a belwo script which is used to get sectors per track value extarcted from Solaris machine: for DISK in /dev/dsk/c*t*d*s*; do value=`prtvtoc "$DISK" | sed -n -e '/Dimensions/,/Flags/{/Dimensions/d; /Flags/d; p; }' | sed -n -e '/sectors\/track/p'`; if ; then echo... (4 Replies)
Discussion started by: omkar.jadhav
4 Replies

10. UNIX for Beginners Questions & Answers

Get an output of lines in pattern 1st line then 10th line then 11th line then 20th line and so on.

Input file: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 (6 Replies)
Discussion started by: Sagar Singh
6 Replies
TORRUS_RRDDIR2XML(8)						      torrus						      TORRUS_RRDDIR2XML(8)

NAME
rrddir2xml - Searches a directory for RRD files and generates Torrus XML configuration file. SYNOPSIS
torrus rrddir2xml --dir=DIR [options...] DESCRIPTION
rrddir2xml searches in a given directory for RRD files and creates Torrus XML configuration file suitable for browsing ofthose data files. With default options, it is usable for RRD files generated by Torrus' SNMP collector, where the file name starts with the host name, separated by underscore from interface name or other MIB specifics. With these defaults, it creates a subtree per each host name, and all RRD files belonging top that host name are sorted alphabetically in that subtree. OPTIONS
--dir=DIR Absolute path to the directory for searching. The directory may contain also non-RRD files. Only regular files are processed, and the symlinks are ignored. --recursive If specified, the directory will be searched recursively. All file names across all subdirectories must be unique. Symlinks to other directories are ignored. --filter=Regexp If the filter is specified, then rrddir2xml lists only those files and subdirectories whose names match the given regular expression. --out=FILE Output XML file name. If relative path given, the file is placed in /etc/torrus/xmlconfig. Default: rrddir.xml. --subtree=SUBTREE Top subtree path in the generted XML. Default is the top of the tree ("/"). --split=REGEXP Regular expression used for splitting the file name into parts to build the subtree hierarchy. Default is a sequence of underscores ("_+"). --levels=INTEGER Number of levels of hierarchy to build by splitting the file names. Default is 2 levels. --comment=TEXT Text to put as "comment" parameter to the top subtree. --holtwinters If specified, Holt-Winters prediciton boundaries and failures are displayed in the graphs. --verbose Prints extra diagnosics. --debug Prints debugging information. SEE ALSO
torrus(8) NOTES
See more documentation at Torrus home page: http://torrus.org AUTHOR
Stanislav Sinyagin <ssinyagin@yahoo.com> torrus 2.03 2013-07-26 TORRUS_RRDDIR2XML(8)
All times are GMT -4. The time now is 02:48 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy