Sponsored Content
Full Discussion: Get value from file!!!!
Top Forums UNIX for Dummies Questions & Answers Get value from file!!!! Post 302116263 by jibsonline on Wednesday 2nd of May 2007 04:19:08 PM
Old 05-02-2007
I am able to get the load average as u said. But i am not able to compare to a number. When i give like

FirstNumber=`uptime | sed -e 's/.*average://' -e 's/ //g' | cut -d',' -f1`
echo $FirstNumber

if [ $FirstNumber -gt 77 ]; then
echo "Greater than 77"
else
echo "Less or equal to 77"
fi



I get an error

0.34
./test2: line 3: [: 0.34: integer expression expected
Less or equal to 77


I think it needs to converted to an integer
 

3 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Match list of strings in File A and compare with File B, C and write to a output file in CSV format

Hi Friends, I'm a great fan of this forum... it has helped me tone my skills in shell scripting. I have a challenge here, which I'm sure you guys would help me in achieving... File A has a list of job ids and I need to compare this with the File B (*.log) and File C (extend *.log) and copy... (6 Replies)
Discussion started by: asnandhakumar
6 Replies

2. Shell Programming and Scripting

Compare 2 text file with 1 column in each file and write mismatch data to 3rd file

Hi, I need to compare 2 text files with around 60000 rows and 1 column. I need to compare these and write the mismatch data to 3rd file. File1 - file2 = file3 wc -l file1.txt 58112 wc -l file2.txt 55260 head -5 file1.txt 101214200123 101214700300 101250030067 101214100500... (10 Replies)
Discussion started by: Divya Nochiyil
10 Replies

3. Shell Programming and Scripting

Shell script (sh file) logic to compare contents of one file with another file and output to file

Shell script logic Hi I have 2 input files like with file 1 content as (file1) "BRGTEST-242" a.txt "BRGTEST-240" a.txt "BRGTEST-219" e.txt File 2 contents as fle(2) "BRGTEST-244" a.txt "BRGTEST-244" b.txt "BRGTEST-231" c.txt "BRGTEST-231" d.txt "BRGTEST-221" e.txt I want to get... (22 Replies)
Discussion started by: pottic
22 Replies
pset_getloadavg(3C)					   Standard C Library Functions 				       pset_getloadavg(3C)

NAME
pset_getloadavg - get system load averages for a processor set SYNOPSIS
#include <sys/pset.h> #include <sys/loadavg.h> int pset_getloadavg(psetid_t pset, double loadavg[], int nelem); DESCRIPTION
The pset_getloadavg() function returns the number of processes assigned to the specified processor set that are in the system run queue, averaged over various periods of time. Up to nelem samples are retrieved and assigned to successive elements of loadavg[]. The system imposes a maximum of 3 samples, representing averages over the last 1, 5, and 15 minutes, respectively. The LOADAVG_1MIN, LOADAVG_5MIN, and LOADAVG_15MIN indices, defined in <sys/loadavg.h>, can be used to extract the data from the appropri- ate element of the loadavg[] array. If pset is PS_NONE, the load average for processes not assigned to a processor set is returned. If pset is PS_MYID, the load average for the processor set to which the caller is bound is returned. If the caller is not bound to a pro- cessor set, the result is the same as if PS_NONE was specified. RETURN VALUES
Upon successful completion, the number of samples actually retrieved is returned. If the load average was unobtainable or the processor set does not exist, -1 is returned and errno is set to indicate the error. ERRORS
The pset_getloadavg() function will fail if: EINVAL The number of elements specified is less than 0, or an invalid processor set ID was specified. The caller is in a non-global zone, the pools facility is active, and the specified processor set is not that of the zone's pool. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Stable | +-----------------------------+-----------------------------+ |MT-Level |Async-Signal-Safe | +-----------------------------+-----------------------------+ SEE ALSO
uptime(1), w(1), psrset(1M), prstat(1M), pset_bind(2), pset_create(2), Kstat(3PERL), attributes(5) SunOS 5.11 28 Jun 2004 pset_getloadavg(3C)
All times are GMT -4. The time now is 10:31 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy