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
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
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
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
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
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
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
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
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
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
LEARN ABOUT DEBIAN
dirfile2ascii
dirfile2ascii(1) GETDATA dirfile2ascii(1)
NAME
dirfile2ascii -- output dirfile database vectors as ASCII text
SYNOPSIS
dirfile2ascii [ OPTION ]... DIRFILE
[ [ -a | -A | -e | -E | -F | -g | -G | -o | -i | -u | -x | -X ] FIELD ]...
DESCRIPTION
Fetches data from a dirfile(5) database specified by DIRFILE and writes it as ASCII to standard output. Any number of vector FIELDs may be
specified. Each specified field is printed in a separate column.
Mandatory arguments to long options are mandatory for short options too.
-d, --delimeter=delim
separate columns by delim. (Default: a single space.)
-f, --first-frame=first_frame-last_frame
read from frame first_frame to frame last_frame (inclusive).
-f, --first-frame=first_frame:nframes
equivalent to --first-frame=first_frame --num-frames=nframes.
-f, --first-frame=first_frame
If first_frame >= 0, start reading at frame first_frame. If first_frame is -1 and --num-frames=nframes is specified, read the last
nframes frames. If --first-frame is not specified, reading starts at frame zero.
-n, --num-frames=nframes
read at most nframes frames. If not specified, or if nframes = 0, all frames to the end-of-field are read.
-p, --precision=format
use format to format output. format may contain any of the flag characters, a field width, and/or a precision as specified in
printf(3). It may not contain a length modifier.
-q, --quiet
don't write diagnostic messages on standard error. (This is the default behaviour).
-s, --skip=frame_skip
if frame_skip > 0, output only one sample for every frame_skip frames.
-v, --verbose
write diagnostic messages on standard error.
-z, --fill=STRING
Fill columns which go past the end of their corresponding field with the string STRING. The default behaviour is to fill columns
with floating-point conversions with NaN and columns with integer conversion with 0, which mirrors what occurs when an attempt is
made to print data from before the start of a field. (Note: the default behaviour cannot be reproduced with this option, since
STRING is applied to all columns, regardless of conversion type.)
In addition to the above, each FIELD argument may be preceded by a short option, one of: -a, -A, -e, -E, -F, -g, -G, -i, -o, -u, -x, -X,
indicating the conversion to be used. See printf(3) for the meaning of these conversion specifiers. The output flags, width, and preci-
sion may be specified by using --precision. If no conversion specifier is given, %f is used.
For conversion specifiers %a, %A, %e, %E, %f, %F, %g, %G, data is read from the dirfile as double precision floats. For conversion speci-
fier %i, data is read as 64-bit signed integers. For conversion specifiers %o, %u, %x, %X, data is read as 64-bit unsigned integers.
LIMITATIONS
No native support for printing complex data is provided. This may be worked around by using dirfile(5) representation suffixes. For exam-
ple, the command
$ dirfile2ascii DIRFILE FIELD.r FIELD.i
will print the real and imaginary parts of the complex valued field FIELD in the first and second columns, respectively.
SEE ALSO
dirfile(5), printf(3)
Version 0.7.1 30 November 2010 dirfile2ascii(1)