Sponsored Content
Top Forums Shell Programming and Scripting Avoiding new line for the counts Post 303012520 by RudiC on Monday 5th of February 2018 11:42:15 AM
Old 02-05-2018
Look at your printf's format string ...

EDIT: Looking again at your sample code, are you sure there's no space between the double quote after the colon and the first backtick when the strange behaviour occurs?

Last edited by RudiC; 02-05-2018 at 01:14 PM..
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

wc -c counts 1 char more per line

Hi, this might be a basic question... why is that wc -c counts 1 more per line than what is there. for example, > cat dum1.txt 123 12 > wc -c dum1.txt 7 dum1.txt Thanks, Sameer. (4 Replies)
Discussion started by: ensameer
4 Replies

2. Shell Programming and Scripting

using find but avoiding sparse files

I am no Unix administrator...I live in windows land. I wrote a script to find files of certain names and process them but was later advised to avoid checking sparse files since it would use up a lot of resources and the files I was looking for were not there. How do I avoid doing the find on... (3 Replies)
Discussion started by: shellFun
3 Replies

3. Shell Programming and Scripting

Avoiding For Loop in Shell Script

I am looking to a solution to the following problem. I have a very large file that looks something like this: Each group of three numbers on each line are three probabilities that sum to one. I want to output the maximum for each group of three. So desired output would be: or... (6 Replies)
Discussion started by: hydrabane
6 Replies

4. Shell Programming and Scripting

word counts for a single line xml file

I have any XML ouput file(file name TABLE.xml), where the data is loaded in A SINGLE LINE, I need help in writting a ksh shell script which gives me the word counts of word <TABLE-ROW> This is my input file. <?xml version="1.0" encoding="UTF-8"?><!--Generated by Ascential Software... (4 Replies)
Discussion started by: pred55
4 Replies

5. UNIX for Dummies Questions & Answers

Avoiding the second run of the script

Hi all, I want to put a check in my script to check if the same instance is already running and not finished and if not then does not allow it to run! in which part of my script I should put this? and any idea how I should write it? tx (4 Replies)
Discussion started by: messi777
4 Replies

6. Shell Programming and Scripting

Avoiding 'sh -c' when running ps from CRON

Hi, I have a script which has the below line: ps -ef | grep ${SCRIPT_NAME} | grep ksh | grep -v grep >> /tmp/instance.tmp When the script is invoked through CRON, I get 2 lines in instance.tmp when actually only one instance is running: cdrd 17790 17789 0 15:14:01 ? 0:00 /bin/ksh... (8 Replies)
Discussion started by: cavallino4u
8 Replies

7. UNIX for Dummies Questions & Answers

Avoiding the history

In bash shell, how we can avoid the commands getting recorded in history file. One way i can think of is : export HISTSIZE=0 Is there any other way to achieve this? Thanks (1 Reply)
Discussion started by: pandeesh
1 Replies

8. Shell Programming and Scripting

Avoiding external utilities

under past circumstances, id be fine running commands like this: case 1: printf '%s\n' "${MASSIVETEXT}" | egrep "i am on the first line" case 2: vprintf '%s\n' "${MASSIVETEXT}" | egrep -v "i am on the first line" This works fine. Bit it calls external utility "egrep" and "printf". ... (5 Replies)
Discussion started by: SkySmart
5 Replies

9. Shell Programming and Scripting

Remove duplicated records and update last line record counts

Hi Gurus, I need to remove duplicate line in file and update TRAILER (last line) record count. the file is comma delimited, field 2 is key to identify duplicated record. I can use below command to remove duplicated. but don't know how to replace last line 2nd field to new count. awk -F","... (11 Replies)
Discussion started by: green_k
11 Replies
ECVT(3) 						   BSD Library Functions Manual 						   ECVT(3)

NAME
ecvt, fcvt, gcvt -- convert double to ASCII string SYNOPSIS
#include <stdlib.h> char * ecvt(double value, int ndigit, int * restrict decpt, int * restrict sign); char * fcvt(double value, int ndigit, int * restrict decpt, int * restrict sign); char * gcvt(double value, int ndigit, char *buf); DESCRIPTION
These functions are provided for compatibility with legacy code. New code should use the snprintf(3) function for improved safety and porta- bility. The ecvt(), fcvt() and gcvt() functions convert the double precision floating-point number value to a NUL-terminated ASCII string. The ecvt() function converts value to a NUL-terminated string of exactly ndigit digits and returns a pointer to that string. The result is padded with zeroes from left to right as needed. There are no leading zeroes unless value itself is 0. The least significant digit is rounded in an implementation-dependent manner. The position of the decimal point relative to the beginning of the string is stored in decpt. A negative value indicates that the decimal point is located to the left of the returned digits (this occurs when there is no whole number component to value). If value is zero, it is unspecified whether the integer pointed to by decpt will be 0 or 1. The decimal point itself is not included in the returned string. If the sign of the result is negative, the integer pointed to by sign is non-zero; otherwise, it is 0. If the converted value is out of range or is not representable, the contents of the returned string are unspecified. The fcvt() function is identical to ecvt() with the exception that ndigit specifies the number of digits after the decimal point (zero-padded as needed). The gcvt() function converts value to a NUL-terminated string similar to the %g printf(3) format specifier and stores the result in buf. It produces ndigit significant digits similar to the %f printf(3) format specifier where possible. If ndigit does allow sufficient precision, the result is stored in exponential notation similar to the %e printf(3) format specifier. If value is less than zero, buf will be prefixed with a minus sign. A decimal point is included in the returned string if value is not a whole number. Unlike the ecvt() and fcvt() func- tions, buf is not zero-padded. RETURN VALUES
The ecvt(), fcvt() and gcvt() functions return a NUL-terminated string representation of value. WARNINGS
The ecvt() and fcvt() functions return a pointer to internal storage space that will be overwritten by subsequent calls to either function. The maximum possible precision of the return value is limited by the precision of a double and may not be the same on all architectures. The snprintf(3) function is preferred over these functions for new code. SEE ALSO
printf(3), strtod(3) STANDARDS
The ecvt(), fcvt() and gcvt() functions conform to IEEE Std 1003.1-2001 (``POSIX.1''). BSD
May 31, 2007 BSD
All times are GMT -4. The time now is 10:28 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy