|
|
|
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 Lion HintsWhat's New:Hints1 new Hints in the last 24 hoursComments last 2 days
Links last 2 weeksNo recent new linksWhat's New in the Forums?
Hints by TopicNews from Macworld
From Our Sponsors |
|
Copyright © 2013 IDG Consumer & SMB (Privacy Policy) Contact Us All trademarks and copyrights on this page are owned by their respective owners. |
Visit other IDG sites: |
|
|
|
Powered by Geeklog Created this page in 0.06 seconds |
|