Sponsored Content
Full Discussion: Remove trailing zeros
Top Forums Shell Programming and Scripting Remove trailing zeros Post 302696549 by pamu on Wednesday 5th of September 2012 06:02:37 AM
Old 09-05-2012
got the question wrong...Smilie

Last edited by pamu; 09-05-2012 at 07:04 AM.. Reason: corrected..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

remove precursing zeros

Hello all, I have a list of reports for stores that are numbered like: s001845,s000022,s198490,s020048,s002385 however the users are displaying the reports as: 1845,22,198490,20048,2385 It isn't real critical but I would like to associate them so they are the same. And since the users are... (2 Replies)
Discussion started by: gozer13
2 Replies

2. Shell Programming and Scripting

Remove O and preceeding zeros in a string

Hi all, Can anybody help me out to write a program in perl to remove O and preceeding zeros. for eg input is O0000123089 - output 123089 Thanks Mahalakshmi.A (10 Replies)
Discussion started by: mahalakshmi
10 Replies

3. UNIX for Dummies Questions & Answers

How to remove trailing spaces

Hi, I have a file like this (ADD_MONTHS((Substr(Trim(BOTH FROM Translate(Maximum(closeDa ------------------------------------------------------------ 2007-06-30 00:00:00 I have a requirement where i need just the date. When i do: tail -1... (2 Replies)
Discussion started by: mahek_bedi
2 Replies

4. Shell Programming and Scripting

Remove trailing G

Hello, I am trying to write a script that will calculate the amount of data remaining in a storage volume. I'm running Tru64 Unix version 5.1B patch kit 6. The script is being run against an AdvFS domain. I am programming in Korn Shell version M-11/16/88f. The basic idea is that I want to run df... (3 Replies)
Discussion started by: Heathe_Kyle
3 Replies

5. Shell Programming and Scripting

How to delete trailing zeros from a variable

Hi All I want to delete trailing zeros from varible. ex: if variable value is 1234.567000 result as 1234.567 if variable has 1234.0000 result as 1234 if variable as abcd.fgh result as abcd.fgh Can somone give me a solution using awk? (16 Replies)
Discussion started by: Chandu2u
16 Replies

6. Shell Programming and Scripting

Removing trailing zeros using sed

Hello All, I have a csv file with 3 columns. The file which looks like this 47850000,100,233 23560000,10000,456 78650000,560000,54 34000000,3456,3 The first column has 4 trailing zeros. I have to remove 4 trailing zeroes from 1st field. The output file should appear as follows. ... (12 Replies)
Discussion started by: grajp002
12 Replies

7. Shell Programming and Scripting

Remove trailing 0 from the field

Hi Freinds, I have file1.txt as below file1.txt 1521894~~-0.400~201207 1521794~~-0.486~201207 152494~~-0.490~201207 152154894~~-0.490~201207 1521894354~~-0.489~201207 expected output : 1521894~~-0.4~201207 1521794~~-0.486~201207 152494~~-0.49~201207... (9 Replies)
Discussion started by: i150371485
9 Replies

8. Shell Programming and Scripting

Remove trailing space

Hi I am trying to remove trailing space from a string. value=${value%% } It is not working. What might be the issue with the above snippet. (7 Replies)
Discussion started by: munna_dude
7 Replies

9. Shell Programming and Scripting

Remove trailing number

I have some strings such as ABC1 ABC2 TYFASDD12 They will only have letters and numbers. In each case I want to remove the last digit? The lengths will vary. So a hard coded substr won't work. What do I do? if it doesn't end in a number, I don't want to remove any characters. (6 Replies)
Discussion started by: guessingo
6 Replies

10. UNIX for Beginners Questions & Answers

Remove trailing zeros from numbers

Hi, I am trying to remove trailing zeros from numbers in a csv file. CSV Input : 0.5000,abc,2.00,2.400,285.850,285a.850,205.180800,mno000,a0b0,2.860 Expected Output : .5,abc,2,2.4,285.85,285a.850,205.1808,mno000,a0b0,2.86 Can you please help. Thanks. (11 Replies)
Discussion started by: manubatham20
11 Replies
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)
All times are GMT -4. The time now is 08:39 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy