Sponsored Content
Full Discussion: Get value from file!!!!
Top Forums UNIX for Dummies Questions & Answers Get value from file!!!! Post 302116267 by Shell_Life on Wednesday 2nd of May 2007 04:50:44 PM
Old 05-02-2007
Jibu,
Again, shell does not handle arithmetics nor comparisons with decimal numbers.
The following code:
Code:
test_var() {
if [ $1 -lt 77 ]; then
 echo "$1 is less than 77"
else
 if [ $1 -eq 77 ]; then
   echo "$1 is equal 77"
 else
   echo "$1 is greater than 77"
 fi
fi
}

test_var 76.8
test_var 77.0
test_var 77.8

Gives the following output:
76.8 is less than 77
77.0 is equal 77
77.8 is equal 77
 

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
Sys::Statistics::Linux::LoadAVG(3pm)			User Contributed Perl Documentation		      Sys::Statistics::Linux::LoadAVG(3pm)

NAME
Sys::Statistics::Linux::LoadAVG - Collect linux load average statistics. SYNOPSIS
use Sys::Statistics::Linux::LoadAVG; my $lxs = Sys::Statistics::Linux::LoadAVG->new; my $stat = $lxs->get; DESCRIPTION
Sys::Statistics::Linux::LoadAVG gathers the load average from the virtual /proc filesystem (procfs). For more information read the documentation of the front-end module Sys::Statistics::Linux. LOAD AVERAGE STATISTICS
Generated by /proc/loadavg. avg_1 - The average processor workload of the last minute. avg_5 - The average processor workload of the last five minutes. avg_15 - The average processor workload of the last fifteen minutes. METHODS
new() Call "new()" to create a new object. my $lxs = Sys::Statistics::Linux::LoadAVG->new; It's possible to set the path to the proc filesystem. Sys::Statistics::Linux::LoadAVG->new( files => { # This is the default path => '/proc', loadavg => 'loadavg', } ); get() Call "get()" to get the statistics. "get()" returns the statistics as a hash reference. my $stat = $lxs->get; EXPORTS
No exports. SEE ALSO
proc(5) REPORTING BUGS
Please report all bugs to <jschulz.cpan(at)bloonix.de>. AUTHOR
Jonny Schulz <jschulz.cpan(at)bloonix.de>. COPYRIGHT
Copyright (c) 2006, 2007 by Jonny Schulz. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.14.2 2012-03-09 Sys::Statistics::Linux::LoadAVG(3pm)
All times are GMT -4. The time now is 12:22 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy