Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Time command issuing all zeroes Post 302833773 by alister on Wednesday 17th of July 2013 08:20:47 PM
Old 07-17-2013
You need to show us your code if you expect accurate advice. Further, the operating system and compiler you're using might be relevant.

Regards,
Alister
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to left trim padded zeroes

I have a filename 'INITIATE_FINAL_ALL_000080889.dat', and I want to capture just the number '80889' from it. Here is what I have so far: %> echo INITIATE_FINAL_ALL_000080889.dat | sed "s/*//g" 000080889 Now, I just need to trim off the padded zeroes. Thanks, - CB (3 Replies)
Discussion started by: ChicagoBlues
3 Replies

2. UNIX for Dummies Questions & Answers

Differences between time command and usr/bin/time

I wondered if someone could point out the differences between the time commmand and usr/bin/time and the accuracy one might have over another. Also, is there a website or two a person could maybe link for me to describe the differences? Thank you for your time. (2 Replies)
Discussion started by: icedrake
2 Replies

3. Shell Programming and Scripting

Removing trailing zeroes

So, I can't figure out how to do a previous question with printf, so I'm taking a different approach. Suppose I have a set of numbers: 1200,135.000000,12.30100,3212.3200,1.759403,,1230,101.101010,100.000000 I want to remove all trailing zeroes after the decimal, and, if it ends up orphaned,... (8 Replies)
Discussion started by: treesloth
8 Replies

4. Shell Programming and Scripting

sed not removing leading zeroes

I have th following file 0000000011 0000000001 0000000231 0000000001 0000000022 noow when i run the following command sed 's/^0+//g' file name I receive the same output and the leading zeroes are not removed from the file . Please let me know how to achieve... (4 Replies)
Discussion started by: asalman.qazi
4 Replies

5. UNIX for Advanced & Expert Users

Issuing a Here Document as a Single Line Command

How can I run a here document on just one line? I ask, because I need to issue it from C++ as a system() or similar command and for security reasons I don't want to write out a shell script file from the program and run it. For example, how could I write: passwd test <<EOF n3wp3ss... (3 Replies)
Discussion started by: BrandonShw
3 Replies

6. Shell Programming and Scripting

awk and leading zeroes

I have the following script that renames filenames like: blah_bleh_91_2011-09-26_00.05.43AM.xls and transforms it in: 91_20110926_000543_3_blih.xls for a in *.xls; do b="$(echo "${a}" | cut -d '_' -f4)" dia=`echo ${b} | cut -c9-10` mes=`echo ${b} | cut -c6-7` anio=`echo ${b} | cut -c1-4`... (4 Replies)
Discussion started by: Tr0cken
4 Replies

7. Homework & Coursework Questions

Time command issuing all zeroes (is now considered homework help)

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: A common problem arising in games and simulations is to generate a random arrangements of integers from 1 to N.... (5 Replies)
Discussion started by: lamentofking
5 Replies

8. Shell Programming and Scripting

Add file extensions to files EXCEPT the script that is issuing

Greetings all, On a RedHat System - I am issuing a command from script.sh that will add a file extension to a listing of files in a directory. It works, but I need to script from having an extension added as well. Here is what I have tried to no luck: for file in `ls * | awk ' /\./{print... (6 Replies)
Discussion started by: jeffs42885
6 Replies

9. UNIX for Dummies Questions & Answers

Using alias after issuing 'su - user'

Hi, Using ksh, I have set up aliases (which work fine) in my user's .profile like this: alias ll = 'ls -lrt' alias cls = 'clear' How do I call these same aliases so that they will work after issuing this: ? su - user I do not want to add aliases to the su shell's .profile or .kshrc. (7 Replies)
Discussion started by: ocbit
7 Replies
time(1) 							   User Commands							   time(1)

NAME
time - time a simple command SYNOPSIS
time [-p] utility [argument]... DESCRIPTION
The time utility invokes utility operand with argument, and writes a message to standard error that lists timing statistics for utility. The message includes the following information: o The elapsed (real) time between invocation of utility and its termination. o The User CPU time, equivalent to the sum of the tms_utime and tms_cutime fields returned by the times(2) function for the process in which utility is executed. o The System CPU time, equivalent to the sum of the tms_stime and tms_cstime fields returned by the times() function for the process in which utility is executed. When time is used as part of a pipeline, the times reported are unspecified, except when it is the sole command within a grouping command in that pipeline. For example, the commands on the left are unspecified; those on the right report on utilities a and c, respectively: time a | b | c { time a } | b | c a | b | time c a | b | (time c) OPTIONS
The following option is supported: -p Writes the timing output to standard error in the following format: real %f user %f sys %f < real seconds>, <user seconds>, <system seconds> OPERANDS
The following operands are supported: utility The name of the utility that is to be invoked. argument Any string to be supplied as an argument when invoking utility. USAGE
The time utility returns exit status 127 if an error occurs so that applications can distinguish "failure to find a utility" from "invoked utility exited with an error indication." The value 127 was chosen because it is not commonly used for other meanings. Most utilities use small values for "normal error conditions" and the values above 128 can be confused with termination due to receipt of a signal. The value 126 was chosen in a similar manner to indicate that the utility could be found, but not invoked. EXAMPLES
Example 1 Using the time command It is frequently desirable to apply time to pipelines or lists of commands. This can be done by placing pipelines and command lists in a single file. This single file can then be invoked as a utility, and the time applies to everything in the file. Alternatively, the following command can be used to apply time to a complex command: example% time sh -c 'complex-command-line' Example 2 Using time in the csh shell The following two examples show the differences between the csh version of time and the version in /usr/bin/time. These examples assume that csh is the shell in use. example% time find / -name csh.1 -print /usr/share/man/man1/csh.1 95.0u 692.0s 1:17:52 16% 0+0k 0+0io 0pf+0w See csh(1) for an explanation of the format of time output. example% /usr/bin/time find / -name csh.1 -print /usr/share/man/man1/csh.1 real 1:23:31.5 user 1:33.2 sys 11:28.2 ENVIRONMENT VARIABLES
See environ(5) for descriptions of the following environment variables that affect the execution of time: LANG, LC_ALL, LC_CTYPE, LC_MES- SAGES, LC_NUMERIC, NLSPATH, and PATH. EXIT STATUS
If utility is invoked, the exit status of time will be the exit status of utility. Otherwise, the time utility will exit with one of the following values: 1-125 An error occurred in the time utility. 126 utility was found but could not be invoked. 127 utility could not be found. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ SEE ALSO
csh(1), shell_builtins(1), timex(1), times(2), attributes(5), environ(5), standards(5) NOTES
When the time command is run on a multiprocessor machine, the total of the values printed for user and sys can exceed real. This is because on a multiprocessor machine it is possible to divide the task between the various processors. When the command being timed is interrupted, the timing values displayed may not always be accurate. BUGS
Elapsed time is accurate to the second, while the CPU times are measured to the 100th second. Thus the sum of the CPU times can be up to a second larger than the elapsed time. SunOS 5.11 1 Feb 1995 time(1)
All times are GMT -4. The time now is 09:48 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy