Sponsored Content
Top Forums Shell Programming and Scripting Sub. numbers in column of output with If Post 302106652 by ja156194 on Sunday 11th of February 2007 10:23:15 AM
Old 02-11-2007
Sub. numbers in column of output with If

This is my script. I am pulling the status of some hard where, but the status is in numerical form. The number 4 means Major and the 5 means Critical. In my script I would like to show the alarm type in aplha rather than numeric form. So if instead of seeing a 4 or 5 you would see MAjor or Critical. I want to use an if becuase I have a few more types but I am trying to keep it simple so I can grasp the concept. I also attached a sample out of my commmand file.

dalsys:dalmso2 > more acgstatus
#!/bin/ksh
# Description:
# This script will pull load info for network NEs.
# Nextel Dallas
# By MSO Tech II Jason C. Kelsey
db=airgen_cm_db@urban_dbhost

tacg=`echo "select a.neinstanceid, a.almacgcomentseverity, b.neinstanceid, b.nename from nmo_almacgcomentry a, neentry b where a.neinstanceid=b.neinstance
id group by b.neinstanceid, b.nename, a.neinstanceid, a.almacgcomentseverity" | /usr/informix/bin/dbaccess $db`

echo "
| | | |
b.neinstanceid.| b.nename | a.neinstanceid.a|a.almacgcomentseverity|
---------------|-----------|-----------------|----------------------|----"

echo $tacg

if [ "" = "4" ]
then {
="Major"
}
fi

if [ "" = "5" ]
then {
="Critical"
}
fi

Output currently:
Here is the put without the if statments...........................
dalsys:dalmso2 > acgstatus
Database selected.
4452 row(s) retrieved.
Database closed.
| | | |
neinstanceid | almacgcomentsever+ | neinstanceid | nename |
---------------|--------------------|-----------------|----------------|----
neinstanceid almacgcomentsever+ neinstanceid nename

9041 4 9041 NTX0322R_IDBEACHBRD
32555 5 32555 NOK3410R_IZNEMIAMI
64586 4 64586 PTX389PR_IVSEBRNVIL
1176 4 1176 NTX1401R_IHCENTERFI
470 4 470 NTX0182R_IDOOOI35_U
62737 4 62737 PTX324PR_ICN_ALICE
63715 4 63715 PTX569PR_IWATLANTA
65711 5 65711 PTX123PR_IBSLUMBERT
69746 4 69746 NTX1822R_IHKATYHAWK
28013 4 28013 NTX1407R_IHFONVILLA
448 4 448 NTX0130R_IDGARLAND

I would be much appricated, I have been at since 2am.. ;-)

Last edited by ja156194; 02-11-2007 at 11:26 AM.. Reason: typo
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to sum numbers in column

Hi, i want to sum all nubers in one column. Example: 12.23 11 23.01 3544.01 I'm trying to do this in awk, but it doesn't work properly. Seems like awk is summing only integers, for example: 12 11 23 3544 It cuts off numbers after dot. I used this command: akw /text/ file.txt |nawk... (1 Reply)
Discussion started by: iahveh
1 Replies

2. UNIX for Advanced & Expert Users

Adding a column of numbers

Hello, I have a file, and one column has both positive and negative numbers. Does anyone know how I can calculate the total of all the values (i.e, +ve and -ve). eg: col1 col2 col3 data 23 data data 76 data data -30 data Thanks Khoom (1 Reply)
Discussion started by: Khoomfire
1 Replies

3. Shell Programming and Scripting

How to add numbers in a column

Hi All thanks a lot for your previous replies. I need some help here. I am writing a script to test a machine for a thereshold. It is genrating the list of number that have to be added but not displaying the added value. The script is like this #!/bin/sh... (1 Reply)
Discussion started by: asirohi
1 Replies

4. Shell Programming and Scripting

4 column tsv file, output 1 specific column

Hello all siteexplorer.search.yahoo.com can output results in tsv format, when opened in excel I get 4 columns. I would like to wget that file, which I can do. I would then like to pull the 2nd column and output it only. I've searched around and found a few bits and pieces but nothing I've... (6 Replies)
Discussion started by: casphar
6 Replies

5. UNIX for Dummies Questions & Answers

Increasing numbers in Column

I have UWIn version of Unix for Desktop. I have a file (Subtitle file of a movie) with the following format abc def ghi jkl mno pqr stuv uvw xyz The subtitles are delayed about a min or few seconds more. I want to increase it to be as shown below: abc def ghi jkl mno pqr stuv ... (4 Replies)
Discussion started by: bobbygsk
4 Replies

6. Shell Programming and Scripting

read numbers from file and output which numbers belongs to which range

Howdy experts, We have some ranges of number which belongs to particual group as below. GroupNo StartRange EndRange Group0125 935300 935399 Group2006 935400 935476 937430 937459 Group0324 935477 935549 ... (6 Replies)
Discussion started by: thepurple
6 Replies

7. 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

8. Shell Programming and Scripting

How to add a column numbers at a particular position?

Problem discription: I have many files which contain the same lines. for instance, (15 lines) file1 ..last column add by hand arbitrarily. 1.78116800 0.68396600 0.00061900 0.47641600 -0.49794500 -0.00024000 -1.70662800 0.29577100 0.67863600 -1.70647600 0.29654600 ... (9 Replies)
Discussion started by: liuzhencc
9 Replies

9. Shell Programming and Scripting

Add up a column of numbers

Given a file test.txt ,I can get a list of numbers in a single column using the command : cat test.txt | cut -d ' ' -f 8 that gives the output as 52 52 52 60 52 How can I get the sum of all the numbers in that column that is displayed? i want the output as sum=268 (4 Replies)
Discussion started by: hitha87
4 Replies

10. UNIX for Dummies Questions & Answers

Adding Column Of Numbers

Hello. Trying to add a column of numbers and combine the 1st and 2nd fields as uniq with the new total. This works to add the numbers but can't figure an easy was to combine the 1st and 2nd column as the list is very long. awk '{s+=$3} END {print s}' bird dog 300 bird dog 100 cat clown 200... (1 Reply)
Discussion started by: jimmyf
1 Replies
HOBBIT-CONFREPORT.CGI(1)				      General Commands Manual					  HOBBIT-CONFREPORT.CGI(1)

NAME
hobbit-confreport.cgi - Xymon Configuration report SYNOPSIS
hobbit-confreport.cgi DESCRIPTION
hobbit-confreport.cgi is invoked as a CGI script via the hobbit-confreport.sh CGI wrapper. hobbit-confreport.cgi provides a plain HTML (Web) report of the Xymon configuration for a group of hosts; which hosts are included is determined by the hosts available on the webpage from where the CGI script is invoked. The configuration report include the hostnames, a list of the statuses monitored for each host, and if applicable any configuration set- tings affecting these. Alerts that may be triggered by status changes are also included. The report is plain HTML without any images included, and therefore suitable for inclusion into e-mails or other documents that may be accessed outside the Xymon system. OPTIONS
--critical Report only on the statuses that are configured to show up on the Critical Systems view. --old-nk-config Use the deprecated NK tag in bb-hosts to determine if tests appear on the Critical Systems view. --env=FILENAME Loads the environment defined in FILENAME before executing the CGI script. --area=NAME Load environment variables for a specific area. NB: if used, this option must appear before any --env=FILENAME option. --debug Enables debugging output. BUGS
Client-side configuration done in the hobbit-clients.cfg(5) is not currently reflected in the report. Critical Systems view configuration is not reflected in the report. SEE ALSO
bb-hosts(5), hobbit-alerts.cfg(5), hobbit-clients.cfg(5), xymon(7) Xymon Version 4.2.3: 4 Feb 2009 HOBBIT-CONFREPORT.CGI(1)
All times are GMT -4. The time now is 10:17 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy