I found below script to check whether the variable is a digit in ksh.
############################
#!/bin/ksh
REPLY="3f"
if ]*\)'` != ${REPLY} && "${REPLY}" != "0" ]]
then
print "is digit\n"
else
print "not digit\n"
fi
############################
Although it works fine, but... (6 Replies)
Folks,
Is there a simple way to replace one digit by two digit using sed.
Example,
mydigit1918_2006_8_8_lag1.csv should be
mydigit1918_2006_08_08_lag01.csv.
I tried this way, but doesn't work.
echo mydigit1989_2006_8_8_lag1.csv|sed 's/]/0]/'
Thank you, (5 Replies)
I have a var storing date
var=`date`
Now the date is returned as
Mon Feb 2 00:25:48 PST 2009
Is there any way to check the date field alone ("2" in above case) and if its a single digit then add a prefix 0 to it and store the result in same variable "var"
My intention in above case is... (3 Replies)
I have to write a c program which takes a 3 digit number n and calculates the value of (2^n)+1 and then determines the number is prime or not.
I have tried to first calculate the value of 2^n and then adding one to it and then apply the logic of prime number.
but the ultimate problem is that... (7 Replies)
Hi,
Does anybody know what the below means:
I have a program containing the following and am trying to understand what it does:
temp=$(echo $count2 | tr -cd )
Cheers
Paul
Please start using code tags (2 Replies)
Hi all,
Need your help here. I have a file with thousand of lines, as shown in example below
KDKJAA 98324
OIDSAJ 324
KJAJAK 100
KJKAJK 89
JOIJOI 21
JDKDJL 12
UOIUOD 10
UDUYDS 8
UIUHKK 6
I would like to grep using... (5 Replies)
Thanks of your suggestions i was able to calculate the delta between some numbers in a column file with .
awk 'BEGIN{last=0}{delta=$1-last; last=$1; print $0" "delta}'
the file was like
499849120.00
500201312.00
500352416.00
500402784.00
500150944.00
499849120.00
500150944.00... (3 Replies)
Discussion started by: Board27
3 Replies
LEARN ABOUT HPUX
ecvt
ecvt(3C)ecvt(3C)NAME
ecvt(), fcvt(), gcvt() - convert floating-point number to string
SYNOPSIS
Obsolescent Interfaces
DESCRIPTION
Converts value to a null-terminated string of ndigit digits and returns a pointer to the string. The high-order digit is non-zero,
unless the value is zero. The low-order digit is rounded. The position of the radix character relative to the beginning of
the string is stored indirectly through decpt (negative means to the left of the returned digits). The radix character is not
included in the returned string. If the sign of the result is negative, the word pointed to by sign is non-zero, otherwise it
is zero.
One of three non-digit characters strings could be returned if the converted value is out of range. A or is returned if the
value is larger than the exponent can contain, and is negative, or positive, respectively. The third string is returned if the
number is illegal, a zero divide for example. The result value is Not A Number (NAN) and would return a character.
Identical to
except that the correct digit has been rounded for printf (FORTRAN F-format) output of the number of digits specified by
ndigit.
Converts the
value to a null-terminated string in the array pointed to by buf and returns buf. It produces ndigit significant digits in
FORTRAN F-format if possible, or E-format otherwise. A minus sign, if required, and a radix character is included in the
returned string. Trailing zeros are suppressed. The radix character is determined by the currently loaded NLS environment
(see setlocale(3C)). If has not been called successfully, the default NLS environment, "C", is used (see lang(5)). The
default environment specifies a period as the radix character.
Obsolescent Interfaces
and convert floating-point number to string.
EXTERNAL INFLUENCES
Locale
The category determines the value of the radix character within the current NLS environment.
WARNINGS
The values returned by and point to an array whose content is overwritten by subsequent calls to these interfaces by the same thread.
and are obsolescent interfaces supported only for compatibility with existing DCE applications. New multi-threaded applications should use
and
AUTHOR
and were developed by AT&T. was developed by AT&T and HP.
SEE ALSO setlocale(3C), printf(3S), lang(5), thread_safety(5), glossary(9).
STANDARDS CONFORMANCE ecvt(3C)