|
|
Add timestamps to Unix commands that run at intervals
Getting back to a pure Perl solution, and I certainly don't want to get into a Perl golf match with Randal, but the whole substr approach is very specific to the formatting of vm_stat output, and as the OP pointed out, this changes between releases.
It can be accomplished more generally using the default autosplitting on whitespace:
Additional columns can be added by simply specifying more indices to the @F array, i.e., As in Hal's example, additional formatting can be added if desired:
This solution has the advantage over the awk (though not gawk) methods by not having to shell out to get the `date`
Add timestamps to Unix commands that run at intervals
Interesting, it previewed/looked fine under Firefox, but I see your issue under Safari. Lets hope this fixes it.
My apologies.
|
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.44 seconds |
|