05-27-2009
Problem in converting number in shell script
Hi All,
I am writing a shell script in which I want to convert a number like :
Suppose the number is "98487657" and we have to convert it to "98000000", what I want to do is to retain first 2 digits and convert all remaining digits to "0".
Number could be of any length (length > 2).
Thanks in advance
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi friends!
I am having some simple shell script files to build postgresql database and all. Now i want to convert those scripts to dos batch scripts(to run on windows XP/2000/NT) because there is no need of unix emulation for latest release of postgresql. Please somebody help me. (1 Reply)
Discussion started by: darwinkna
1 Replies
2. Shell Programming and Scripting
Hi,
Im new to shell scripting. My task is to convert shell script feed into html, so basically I have a lot of information in shell script and I want to convert it html. I know you can simply convert the information by hand, but is there any simpler way? Thank you
Dave (3 Replies)
Discussion started by: davwel
3 Replies
3. Shell Programming and Scripting
:confused:Please I really need help with an assignment question. I need to write a script that will take the input from a file and convert the number from Centigrade(Celcius) to Fahrenheit or vice versa. Thank you so much. I really need it to be detailed. Please remember the input comes from a file. (1 Reply)
Discussion started by: starter101
1 Replies
4. UNIX for Advanced & Expert Users
I have a script which converts rows to columns.
file_name=$1
mailid=$2
#CREATE BACKUP OF ORIGINAL FILE
#cp ${file_name}.xlsx ${file_name}_temp.xlsx
#tr '\t' '|' < ${file_name}_temp.xlsx > ${file_name}_temp.csv
#rm ${file_name}_temp.xlsx
pivot_row=`head -1 ${file_name}`
sed 1d... (0 Replies)
Discussion started by: andy538
0 Replies
5. Shell Programming and Scripting
I have a script which converts rows to columns.
file_name=$1
mailid=$2
#CREATE BACKUP OF ORIGINAL FILE
#cp ${file_name}.xlsx ${file_name}_temp.xlsx
#tr '\t' '|' < ${file_name}_temp.xlsx > ${file_name}_temp.csv
#rm ${file_name}_temp.xlsx
pivot_row=`head -1 ${file_name}`
sed 1d... (3 Replies)
Discussion started by: andy538
3 Replies
6. UNIX for Dummies Questions & Answers
Hi,
I am having a problem in converting a string to number so I can preform arithmetic operations.
timeTot=0
timeTmp=$(cat idsOutput | grep 'Run time' | cut -c 36-39)
timeTot=$ #This is line 28
echo "total RunTime=" $timeTot
this is the error msg:
./ids2.sh: line 28: 0+1.35: syntax... (8 Replies)
Discussion started by: turki_00
8 Replies
7. Shell Programming and Scripting
Hi I have a dat file which has "n" number of columns. The file is delimited. The number of columns keep varying as the file is generated out of DB queries. Could you please help me in writing a script which will generate a XLS or CSV file out of the dat file. (5 Replies)
Discussion started by: Vee
5 Replies
8. Shell Programming and Scripting
Hi I am new in programming.
I have written a shell code, but i want to secure my code.
I have tried SHC. It is converting it to binary, but can be converted in plain text again by core dump.
I have tried to convert it in rpm by "rpmbuild -bb my.spec" option but the result is same.
... (4 Replies)
Discussion started by: Priy
4 Replies
9. UNIX for Beginners Questions & Answers
I am currently migrating to ubuntu from my windows system. Now I am learing to convert all my batch scripts into linux shell. Although the common commands are more or less similar, but I found it difficult for the following set of commands in windows cmd:
setlocal
:PROMPT
SET /P... (2 Replies)
Discussion started by: net.genere
2 Replies
10. Shell Programming and Scripting
Hello everybody, :)
I need some help with a school project that I have to create for the next week. :eek:
So first, the aim of the Script is that I have a WebSite with a lot of .html / .shtml / .js / .css in one directory. That directory have few directory too but that's not so important,... (1 Reply)
Discussion started by: mariocrocop
1 Replies
LEARN ABOUT HPUX
_ldfcvt_r
ldcvt(3C) ldcvt(3C)
NAME
_ldecvt(), _ldfcvt(), _ldgcvt() - convert long-double 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; other-
wise it is zero.
is identical to
except that the correct digit has been rounded for printf (FORTRAN F-format) output of the number of digits specified by
ndigit.
Convert the value to a null-terminated string in the array pointed to by buf and return 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 are 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
convert long-double floating-point number to string.
RETURN VALUE
is returned for Not-a-Number, and is returned for Infinity.
WARNINGS
The values returned by and point to data 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 multithreaded applications should use
and
EXTERNAL INFLUENCES
Locale
The category determines the radix character.
International Code Set Support
Single-byte character code sets are supported.
AUTHOR
and were developed by HP.
SEE ALSO
setlocale(3C), printf(3S), lang(5), thread_safety(5).
ldcvt(3C)