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 OSX
digittoint_l
DIGITTOINT(3) BSD Library Functions Manual DIGITTOINT(3)NAME
digittoint, digittoint_l -- convert a numeric character to its integer value
LIBRARY
Standard C Library (libc, -lc)
SYNOPSIS
#include <ctype.h>
int
digittoint(int c);
#include <xlocale.h>
#include <ctype.h>
int
digittoint_l(int c, locale_t loc);
DESCRIPTION
The digittoint() function converts a numeric character to its corresponding integer value. The character can be any decimal digit or hexa-
decimal digit. With hexadecimal characters, the case of the values does not matter.
While the digittoint() function uses the current locale, the digittoint_l() function may be passed a locale directly. See xlocale(3) for more
information.
RETURN VALUES
The digittoint() function always returns an integer from the range of 0 to 15. If the given character was not a digit as defined by
isxdigit(3), the function will return 0.
SEE ALSO ctype(3), isdigit(3), isxdigit(3), xlocale(3)BSD April 6, 2001 BSD