Sponsored Content
Top Forums Shell Programming and Scripting Help Reading from Command Like vmstat Post 302472518 by DGPickett on Wednesday 17th of November 2010 10:17:27 AM
Old 11-17-2010
Would you like unix time, gregorian date-time, microseconds, delta microseconds? Simplest with min latency:
Code:
... | while [ 1 ]
 do
   l=`line`
  date '+%whatever'"$l"
 done

Commands that read stdin with a buffered FILE* often get the pipe data several K at a time, delayed. I have found that reading one byte at a time, like line does, overcomes this latency. Commands that write() one line at a time may not have this problem. Your UNIX may vary!
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Reading the output of df command

Can any body please explain the following df command to me:filesystem kbytes used avail capacity mounted on /dev/root 6474195 2649052 3825143 41% / /dev/stand 24097 5757 18340 24% /stand /proc 0 0 0 ... (7 Replies)
Discussion started by: nervous
7 Replies

2. UNIX for Dummies Questions & Answers

Does command for reading from memory exist?

Does exist in unix any command which could read data from any memory address or port and return result on screen? (2 Replies)
Discussion started by: linuxchemist
2 Replies

3. Shell Programming and Scripting

VMSTAT script / command help

Hello all, I know it can be done but don't know the command. I would like to run vmstat via cron, I don't know a good interval and don't want huge logs but want stats pretty often. Please someone who uses vmstat via cron let me know what your script looks like. Thank you (11 Replies)
Discussion started by: komputersman
11 Replies

4. UNIX and Linux Applications

Reading values from the command line

Hi I want to give the user the choice of whether or not they want to include a certain option when they run the script. This is my getops: while getopts " s: d: r f: e h " option do case $option in f ) dsxfile="$OPTARG";; d ) dbname="$OPTARG";; s ) dsn="$OPTARG";; r )... (0 Replies)
Discussion started by: ladyAnne
0 Replies

5. Shell Programming and Scripting

egrep -w command by reading from file

Dear All, I want to get the rows from file1.txt whose first column is exactly as the numbers (not subset) from file1.txt. so, i have to read by line from file1.txt and search in file2.txt. So the first column of the output must be the same as the file1.txt. I used % egrep -w -f... (5 Replies)
Discussion started by: senayasma
5 Replies

6. Shell Programming and Scripting

Reading command options one by one

Hi, Just some questions on the script below...? Given: bash-2.03$ command -a option1 name1 name2 ParseOptions() { local Len=${#@} local Ctr=2 #always start at 2 local Name=() local Iter=0 while ; do if <- Is this correct? so I can get the $2... (2 Replies)
Discussion started by: h0ujun
2 Replies

7. Shell Programming and Scripting

help with reading command line into array

set -A title set -A author count=1 index=0 while do read -A ${title}?"Booktitle: " read -A ${author}?"Author(s): " (( count = count + 1 )) (( index = index + 1 )) done Hi... (1 Reply)
Discussion started by: bjhum33
1 Replies

8. Shell Programming and Scripting

Error in reading the output from command

I getting error as test1.sh: syntax error at line 3: `do' unexpected while i was trying to run below code.. What was going wrong here? find /usr/tmp/SB/reports/ -type f -name *.rdf |read file;do echo "Copying $file to /usr/tmp/SB1" done (1 Reply)
Discussion started by: millan
1 Replies

9. UNIX for Dummies Questions & Answers

Help with reading and calling a command in a script

The problem I am having now is calling and reading a command and The Main script reads the data file and passes the input to the two calculation scripts, and than output to a file. 1. The Main Script ----------------- input=inputfilepj3 output=outfilepj3 echo "*** Converting... (2 Replies)
Discussion started by: TheUnitedOSI
2 Replies

10. Shell Programming and Scripting

Reading from file bash command

Hello, I have a file in the following format id sample platform R1 R2 gene1 gene2 gene3 1 abc llumina R1_001.fastq.gz R2_001.fastq.gz apoe prnpp asp 2 def llumina R1_001.fastq.gz R2_001.fastq.gz apoe prnpp 3 ghi llumina ... (3 Replies)
Discussion started by: nans
3 Replies
VMSTAT(8)						   Linux Administrator's Manual 						 VMSTAT(8)

NAME
vmstat - Report virtual memory statistics SYNOPSIS
vmstat [-n] [delay [ count]] vmstat[-V] DESCRIPTION
vmstat reports information about processes, memory, paging, block IO, traps, and cpu activity. The first report produced gives averages since the last reboot. Additional reports give information on a sampling period of length delay. The process and memory reports are instantaneous in either case. Options The -n switch causes the header to be displayed only once rather than periodically. delay is the delay between updates in seconds. If no delay is specified, only one report is printed with the average values since boot. count is the number of updates. If no count is specified and delay is defined, count defaults to infinity. The -V switch results in displaying version information. FIELD DESCRIPTIONS
Procs r: The number of processes waiting for run time. b: The number of processes in uninterruptable sleep. w: The number of processes swapped out but otherwise runnable. This field is calculated, but Linux never desperation swaps. Memory swpd: the amount of virtual memory used (kB). free: the amount of idle memory (kB). buff: the amount of memory used as buffers (kB). Swap si: Amount of memory swapped in from disk (kB/s). so: Amount of memory swapped to disk (kB/s). IO bi: Blocks sent to a block device (blocks/s). bo: Blocks received from a block device (blocks/s). System in: The number of interrupts per second, including the clock. cs: The number of context switches per second. CPU These are percentages of total CPU time. us: user time sy: system time id: idle time NOTES
vmstat does not require special permissions. These reports are intended to help identify system bottlenecks. Linux vmstat does not count itself as a running process. All linux blocks are currently 1k, except for CD-ROM blocks which are 2k. FILES
/proc/meminfo /proc/stat /proc/*/stat SEE ALSO
ps(1), top(1), free(1) BUGS
Does not tabulate the block io per device or count the number of system calls. AUTHOR
Written by Henry Ware <al172@yfn.ysu.edu>. Throatwobbler Ginkgo Labs 27 July 1994 VMSTAT(8)
All times are GMT -4. The time now is 04:08 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy