Sponsored Content
Top Forums Shell Programming and Scripting How to store the output of "time dd if= of=" in a variable Post 302294019 by amio on Wednesday 4th of March 2009 09:47:47 AM
Old 03-04-2009
Hi Gee-Money,

Thanks for ur reply. It did not work.
I also tried,
Code:
sec=$({TIMEFORMAT=%S;time dd if=/dev/zero of=/dev/sda1 bs=512 count=2048;sync;} 2>&1)
echo Seconds: $sec

But the variable sec shows the output of "dd" command.. But i need the variable to show the output of time command...

thanks
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Please help formatting bash "time" variable to HH:MM:SS format

Ok, this is going to be hard to describe, but here it goes. I have written a bash script that, while executing starts a timer, and when done stops the timer. The $RUNTIME variable value is in seconds, so the variable usually equals a number like 126 (equals 2 minutes 6 seconds). In my script I... (3 Replies)
Discussion started by: vikingshelmut
3 Replies

2. Shell Programming and Scripting

passing the output of cmd from "eval" to a variable

Hello, I need help with the eval command. I have been building a lengthy cmd using eval, and I need to create $var from the output of the cmd. Here is what I have. Out=/dfezz1/output.txt Node="'LPAR Info:'" Gr3p0=" |grep" Printc=" prtconf" Output1=" 1>>$Out 0>&1" Cat1="cat... (8 Replies)
Discussion started by: dfezz1
8 Replies

3. Shell Programming and Scripting

store the output of "find" command in a variable?

I intend to find the path/full location of a file(filename given by user thru "read filenme") using "find" or any other command and then store it's output in a variable for some other processing. But struggling to put all things together (i.e finding the fully qualified location of that file and... (4 Replies)
Discussion started by: punitpa
4 Replies

4. Shell Programming and Scripting

ksh script that echo " please insert your name " and store the output to a login.log file.

Hello All Nice to meet you all here in this forum, it's my 1rst time here i'm asking about a little issue that i face i added a ksh script that echo " please insert your name " and store the output to a login.log file. the script is working fine with normal telnet but Xstart is not working... (8 Replies)
Discussion started by: islam.said
8 Replies

5. Shell Programming and Scripting

"Join" or "Merge" more than 2 files into single output based on common key (column)

Hi All, I have working (Perl) code to combine 2 input files into a single output file using the join function that works to a point, but has the following limitations: 1. I am restrained to 2 input files only. 2. Only the "matched" fields are written out to the "matched" output file and... (1 Reply)
Discussion started by: Katabatic
1 Replies

6. Shell Programming and Scripting

Unable to store "-e" in variable ??????

p="-e" echo $p It is not returning the value "-e" stored. Instead returns null. I am wondering how could this happen. Please help me out.I tried all possibilities like p='-e' | p="\-e". Nothing seems to work. :confused::confused: (10 Replies)
Discussion started by: shanneykar
10 Replies

7. Shell Programming and Scripting

Store Host lookup in variable ("on the fly")

Hi, I'm new here. I was wondering why I can't store a host lookup in a variable. for line in $(< blacklist) do STOREIP=host $line; if ]; then $line >> blacklist2; else $line >> blacklist3; fi done Result: "ip" command not found .. so how would I store the host lookup in the... (2 Replies)
Discussion started by: sOliver
2 Replies

8. Shell Programming and Scripting

Storing output of "time" command to a variable

Hi all, I am new to Linux/shell scripting having moderate knowledge. In my script, I need to get execution time of a command (say 'ls') in mili seconds level. For this i tried using "time" command to retrieve the total execution time in milli seconds. But, the problem is that, how to save... (9 Replies)
Discussion started by: happening_linux
9 Replies

9. Shell Programming and Scripting

Get "n" number of lines from the specified file and store the output to the new file

Hiii. How are you all. .. I have started to learn bash scripting.. . and I am pretty much trying to execute this script which I am still not successful.. . This is what I am trying to do. .. need to get "n" number of lines from the specified file and store the output to the new file in... (5 Replies)
Discussion started by: zsycho
5 Replies

10. Shell Programming and Scripting

Unable to store "python --version" to a shell variable

Hi All, I need to get the version of python installed and store it in a variable for later use. Whereas it is printing on the console instead of storing to variable. I am able to store output of ls command in a variable. Please check the below code : root@myhost:/volumes/srini# cat... (4 Replies)
Discussion started by: srinivasan.neel
4 Replies
acctcom(1)							   User Commands							acctcom(1)

NAME
acctcom - search and print process accounting files SYNOPSIS
acctcom [-abfhikmqrtv] [-C sec] [-e time] [-E time] [-g group] [-H factor] [-I chars] [-l line] [-n pattern] [-o output-file] [-O sec] [-s time] [-S time] [-u user] [filename...] DESCRIPTION
The acctcom utility reads filenames, the standard input, or /var/adm/pacct, in the form described by acct.h(3HEAD) and writes selected records to standard output. Each record represents the execution of one process. The output shows the COMMAND NAME, USER, TTYNAME, START TIME, END TIME, REAL (SEC), CPU (SEC), MEAN SIZE (K), and optionally, F (the fork()/exec() flag: 1 for fork() without exec()), STAT (the system exit status), HOG FACTOR, KCORE MIN, CPU FACTOR, CHARS TRNSFD, and BLOCKS READ (total blocks read and written). A `#' is prepended to the command name if the command was executed with super-user privileges. If a process is not associated with a known terminal, a `?' is printed in the TTYNAME field. If no filename is specified, and if the standard input is associated with a terminal or /dev/null (as is the case when using `&' in the shell), /var/adm/pacct is read; otherwise, the standard input is read. If any filename arguments are given, they are read in their respective order. Each file is normally read forward, that is, in chronological order by process completion time. The file /var/adm/pacct is usually the current file to be examined; a busy system may need several such files of which all but the current file are found in /var/adm/pacctincr. OPTIONS
The following options are supported: -a Show some average statistics about the processes selected. The statistics will be printed after the output records. -b Read backwards, showing latest commands first. This option has no effect when standard input is read. -f Print the fork()/exec() flag and system exit status columns in the output. The numeric output for this option will be in octal. -h Instead of mean memory size, show the fraction of total available CPU time consumed by the process during its execution. This "hog factor" is computed as (total CPU time)/(elapsed time). -i Print columns containing the I/O counts in the output. -k Instead of memory size, show total kcore-minutes. -m Show mean core size (the default). -q Do not print any output records, just print the average statistics as with the -a option. -r Show CPU factor (user-time/(system-time + user-time)). -t Show separate system and user CPU times. -v Exclude column headings from the output. -C sec Show only processes with total CPU time (system-time + user-time) exceeding sec seconds. -e time Select processes existing at or before time. -E time Select processes ending at or before time. Using the same time for both -S and -E shows the processes that existed at time. -g group Show only processes belonging to group. The group may be designated by either the group ID or group name. -H factor Show only processes that exceed factor, where factor is the "hog factor" as explained in option -h above. -I chars Show only processes transferring more characters than the cutoff number given by chars. -l line Show only processes belonging to terminal /dev/term/line. -n pattern Show only commands matching pattern that may be a regular expression as in regcmp(3C), except + means one or more occur- rences. -o output-file Copy selected process records in the input data format to output-file; suppress printing to standard output. -O sec Show only processes with CPU system time exceeding sec seconds. -s time Select processes existing at or after time, given in the format hr[:min[:sec]]. -S time Select processes starting at or after time. -u user Show only processes belonging to user. The user may be specified by a user ID, a login name that is then converted to a user ID, `#' (which designates only those processes executed with superuser privileges), or `?' (which designates only those processes associated with unknown user IDs). FILES
/etc/group system group file /etc/passwd system password file /var/adm/pacctincr active processes accounting file ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWaccu | +-----------------------------+-----------------------------+ |CSI |enabled | +-----------------------------+-----------------------------+ SEE ALSO
ps(1), acct(1M), acctcms(1M), acctcon(1M), acctmerg(1M), acctprc(1M), acctsh(1M), fwtmp(1M), runacct(1M), su(1M), acct(2), regcmp(3C), acct.h(3HEAD), utmp(4), attributes(5) System Administration Guide: Basic Administration NOTES
acctcom reports only on processes that have terminated; use ps(1) for active processes. SunOS 5.10 11 Jan 1996 acctcom(1)
All times are GMT -4. The time now is 11:26 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy