1st argument to printf is the format. %s to print $1 as string, %d is to print as integer where 02 is to padd ZERO on left if ($2-4) width is less than 2.
For more detail, Look at printf manual or other info available on internet.
This User Gave Thanks to anurag.singh For This Post:
Hi All,
I am working on a korn shell script.
I have a problem.i am calculating the next 27 hours
from the time stamp.
say TSTAMP=20060724000000
if i add 27 hours to the above time stamp,
i will get 20060724143000
this is the code:
YEAR=`echo $TSTAMP | awk... (0 Replies)
Hi
i want to print the time of a process in hours only..(or) in minutes only.Is there anyway to print the process such like that
when i give the commnand like following
#ps -eo pid,time
PID TIME
412 01:49:32
481 00:03
it shows in HH:MM:SS format:
Could anyone... (1 Reply)
Dear Folks,
I want to calculate the elapsed hours between two time columns. I am using timestampdiff method for the same. I am able to get the value. But facing an issue of decimal values. For example the elapsed hours between 09:00:00 and 20:30:00 is coming as 11 instead of 11.5. I am using below... (1 Reply)
I want to add a crontab entry which should execute for every 4 hours and that 4 hours calculation should begin from the current time.
Normally if I set the crontab entry like this,
00 */4 30 05 * root date >>/tmp/cronout
The above will execute the date command for every 4 hours like... (7 Replies)
Hi ,
We have around 22 logs , each has different entries. I have to automate this using shell script. The ideas which am sharing is given below
1) We use only TAIL -100 <location and name of the log> Command to check the logs.
2) We want to check whether the log was updated before 24... (13 Replies)
Dear All
I want to diff between two time(FIRST 4 COLUMN) in hours in last column. Kindly help me for same.
2013-11-23 15:51:23 2013-11-23 12:20:06 BRC023 CG
2013-11-23 15:51:23 2013-11-23 12:20:08 BRC064CG
2013-11-23 15:51:23 2013-11-22 13:17:49 BLM003 NG
2013-11-23 15:51:23 2013-11-22... (9 Replies)
I have created the script to grep the errors from weblogic logs files and redirecting output to file.txt ...From file.txt I'm using awk command to collect the past 20 mins output...The script running from cron every 15 mins... The script working well...
Now the challenges, I'm trying to use... (27 Replies)
Hello All,
I am working on script where I need to add hours,minutes or seconds in the time.Time is not the current but it could be future time.I thought I can store that time in variable and add hours.minutes or second but I am not able to add that in the time that is stores in a variable.
Time... (9 Replies)
I have unix epoch time 1441678454803, Can you please help me to print this time in below format ?
DAY,HOUR,MIN,SEC
Appreciate your help!!!
Thanks,
Prince (7 Replies)
Gents,
Is there the way to increase hours (+3) to the data with the format following.
example
JDhhmmss
335193508
input
335193508
335203508
335213508
335223508
335233508
output
335223508
335233508
336003508
336013508 (14 Replies)
Discussion started by: jiam912
14 Replies
LEARN ABOUT DEBIAN
fmtcheck
FMTCHECK(3) BSD Library Functions Manual FMTCHECK(3)NAME
fmtcheck -- sanitizes user-supplied printf(3)-style format string
LIBRARY
Utility functions from BSD systems (libbsd, -lbsd)
SYNOPSIS
#include <bsd/stdio.h>
const char *
fmtcheck(const char *fmt_suspect, const char *fmt_default);
DESCRIPTION
The fmtcheck() scans fmt_suspect and fmt_default to determine if fmt_suspect will consume the same argument types as fmt_default and to
ensure that fmt_suspect is a valid format string.
The printf(3) family of functions cannot verify the types of arguments that they are passed at run-time. In some cases, like catgets(3), it
is useful or necessary to use a user-supplied format string with no guarantee that the format string matches the specified arguments.
The fmtcheck() was designed to be used in these cases, as in:
printf(fmtcheck(user_format, standard_format), arg1, arg2);
In the check, field widths, fillers, precisions, etc. are ignored (unless the field width or precision is an asterisk '*' instead of a digit
string). Also, any text other than the format specifiers is completely ignored.
RETURN VALUES
If fmt_suspect is a valid format and consumes the same argument types as fmt_default, then the fmtcheck() will return fmt_suspect. Other-
wise, it will return fmt_default.
SECURITY CONSIDERATIONS
Note that the formats may be quite different as long as they accept the same arguments. For example, "%p %o %30s %#llx %-10.*e %n" is com-
patible with "This number %lu %d%% and string %s has %qd numbers and %.*g floats (%n)". However, "%o" is not equivalent to "%lx" because the
first requires an integer and the second requires a long.
SEE ALSO printf(3)BUGS
The fmtcheck() function does not understand all of the conversions that printf(3) does.
BSD October 16, 2002 BSD