The trailing % sign makes $5 a string, and the > compares strings.
The +0 ensures that the > compares numbers.
Most awk versions will then ignore the trailing % sign.
But a few awk versions convert such strings to zero; they need
The sub() should return 1 (true) on a successfull substitution. So maybe you can omit a further test like $2~/dev/.
This User Gave Thanks to MadeInGermany For This Post:
Could someone tell me how to perform calculations using numbers greater than 2150000000 in Korn Shell? When I tried to do it it gave me the wrong answer.
e.g. I have a ksh file with the contents below:
---------------------------------
#!/bin/ksh
SUM=`expr 2150000000 + 2`
PRODUCT=`expr... (3 Replies)
I have some ASCII files containing numerous numbers. What I'd like to do is replace all numbers greater than 0 with 1.
Examples of the numbers include: - 000011 and 000042
Thanks (4 Replies)
i have a file contains:
13213,A,300
3423,C,200
5563,A,201
3000,A,400
3000,A,402
3000,A,206
3000,A,303
3000,A,200
4233,N,204
i need to search for numbers in the first column are greater than 3000?
i have another issue if you can help me?
if i want to search in the second or the... (7 Replies)
Hi, as the title states i need to find a way to search a column for values great than 1000, and if it is, then delete that row.
An example
1 7.021 6.967 116.019 4 U 6.980E+07 0.000E+00 e 0 0 0 0
2 8.292 7.908 118.063 3 U 1.440E+07 0.000E+00 e 0 821 814 ... (3 Replies)
Hi, I need to write a script that will read each line of a CSV file, look for values greater than x seconds and email an alert.
For the first part, I have one CSV per day, each line in the CSV has comma separated values. There are a total of 8 fields per line separated by commas. 6th and 7th... (3 Replies)
I have a file with multiple fields, example below
File 1:
Field 1|Field 2|Field 3|Field 4|Field 5|Field 6|Field 7|100
Field 1|Field 2|Field 3|Field 4|Field 5|Field 6|Field 7|101
Field 1|Field 2|Field 3|Field 4|Field 5|Field 6|Field 7|102
Field 1|Field 2|Field 3|Field 4|Field 5|Field... (4 Replies)
I'm trying to grep lines where the digits at the end of each line are greater than digits. Tried this but it will only allow me to specify 2 digits. Any ideas would greatly be appreciated. grep -i '\<\{3,4,5\}\>' file
---------- Post updated at 05:58 PM ---------- Previous update was at 05:41... (1 Reply)
Hi again. Sorry for all the questions — I've tried to do all this myself but I'm just not good enough yet, and the help I've received so far from bartus11 has been absolutely invaluable. Hopefully this will be the last bit of file manipulation I need to do.
I have a file which is formatted as... (4 Replies)
This matrix represents correlation values.
Is it possible to calculate the percentage of columns (a1, a2, a3) that have a value >= |0.5| and report the percentage that has positive correlation >0.5 and negative correlation <-0.5 separately. thanx in advance!
input
name a1 a2 a3... (5 Replies)
Discussion started by: quincyjones
5 Replies
LEARN ABOUT OPENSOLARIS
qeconvert
econvert(3C) Standard C Library Functions econvert(3C)NAME
econvert, fconvert, gconvert, seconvert, sfconvert, sgconvert, qeconvert, qfconvert, qgconvert - output conversion
SYNOPSIS
#include <floatingpoint.h>
char *econvert(double value, int ndigit, int *decpt, int *sign,
char *buf);
char *fconvert(double value, int ndigit, int *decpt, int *sign,
char *buf);
char *gconvert(double value, int ndigit, int trailing, char *buf);
char *seconvert(single *value, int ndigit, int *decpt, int *sign,
char *buf);
char *sfconvert(single *value, int ndigit, int *decpt, int *sign,
char *buf);
char *sgconvert(single *value, int ndigit, int trailing, char *buf);
char *qeconvert(quadruple *value, int ndigit, int *decpt, int *sign,
char *buf);
char *qfconvert(quadruple *value, int ndigit, int *decpt, int *sign
char *buf);
char *qgconvert(quadruple *value, int ndigit, int trailing, char *buf);
DESCRIPTION
The econvert() function converts the value to a null-terminated string of ndigit ASCII digits in buf and returns a pointer to buf. buf
should contain at least ndigit+1 characters. The position of the decimal point relative to the beginning of the string is stored indirectly
through decpt. Thus buf == "314" and *decpt == 1 corresponds to the numerical value 3.14, while buf == "314" and *decpt == -1 corresponds
to the numerical value .0314. If the sign of the result is negative, the word pointed to by sign is nonzero; otherwise it is zero. The
least significant digit is rounded.
The fconvert() function works much like econvert(), except that the correct digit has been rounded as if for sprintf(%w.nf) output with
n=ndigit digits to the right of the decimal point. ndigit can be negative to indicate rounding to the left of the decimal point. The return
value is a pointer to buf. buf should contain at least 310+max(0,ndigit) characters to accomodate any double-precision value.
The gconvert() function converts the value to a null-terminated ASCII string in buf and returns a pointer to buf. It produces ndigit sig-
nificant digits in fixed-decimal format, like sprintf(%w.nf), if possible, and otherwise in floating-decimal format, like sprintf(%w.ne);
in either case buf is ready for printing, with sign and exponent. The result corresponds to that obtained by
(void) sprintf(buf,``%w.ng'',value) ;
If trailing = 0, trailing zeros and a trailing point are suppressed, as in sprintf(%g). If trailing != 0, trailing zeros and a trailing
point are retained, as in sprintf(%#g).
The seconvert(), sfconvert(), and sgconvert() functions are single-precision versions of these functions, and are more efficient than the
corresponding double-precision versions. A pointer rather than the value itself is passed to avoid C's usual conversion of single-precision
arguments to double.
The qeconvert(), qfconvert(), and qgconvert() functions are quadruple-precision versions of these functions. The qfconvert() function can
overflow the decimal_record field ds if value is too large. In that case, buf[0] is set to zero.
The ecvt(), fcvt() and gcvt() functions are versions of econvert(), fconvert(), and gconvert(), respectively, that are documented on the
ecvt(3C) manual page. They constitute the default implementation of these functions and conform to the X/Open CAE Specification, System
Interfaces and Headers, Issue 4, Version 2.
USAGE
IEEE Infinities and NaNs are treated similarly by these functions. ``NaN'' is returned for NaN, and ``Inf'' or ``Infinity'' for Infinity.
The longer form is produced when ndigit >= 8.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|MT-Level |MT-Safe |
+-----------------------------+-----------------------------+
SEE ALSO ecvt(3C),sprintf(3C), attributes(5)SunOS 5.11 3 May 1999 econvert(3C)