|
|
Add timestamps to Unix commands that run at intervals
Or you could use the following, as it's easier to understand what's going on:
vm_stat 2 | gawk '{print strftime("%H:%M:%S:"), $1, $2, $3, $4}'(note: this requires the GNU version of awk installed.)
Add timestamps to Unix commands that run at intervals
Sorry, I should have mentioned that I wrote that on Leopard (in case it matters), and that you can pick and choose what columns you want by knowing that $1 is the first column, $2 is the second, and so on....
Add timestamps to Unix commands that run at intervals
Hello,
If you don't have gawk, then you can try the following workaround:
Add timestamps to Unix commands that run at intervals
That doesn't do the right thing; it prefixes every line with the time the command was started. Try
Or using just the shell:
More likely you'd make one of these a script, shell function, or alias, so that you could apply it easily to any output.
Add timestamps to Unix commands that run at intervals
Oh! You're right. I was paying attention to my test output. Thanks.
Add timestamps to Unix commands that run at intervals
Retain the formatting with cut:
My usage of date also gives you UTC ISO timestamping for free...
Add timestamps to Unix commands that run at intervals
hm...
Add timestamps to Unix commands that run at intervals
Then just use
cut -c 36 ;)
I still prefer the perl/awk version because fixing width at 36 is BADİ ---
Sylvain |
SearchFrom our Sponsor...Latest Mountain Lion HintsWhat's New:HintsNo new hintsComments last 2 daysNo new commentsLinks last 2 weeksNo recent new linksWhat's New in the Forums?
Hints by TopicNews from Macworld
From Our Sponsors |
|
Copyright © 2014 IDG Consumer & SMB (Privacy Policy) Contact Us All trademarks and copyrights on this page are owned by their respective owners. |
Visit other IDG sites: |
|
|
|
Created this page in 0.13 seconds |
|