Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


uptime... | 7 comments | Create New Account
Click here to return to the 'uptime...' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
uptime...
Authored by: ret on Feb 13, '02 08:02:34PM
If you know you want the last column of the output, you can use:
uptime | awk '{print $NF}'
As inferred elsewhere in this thread, $1...$12 refer to field 1... field 12. NF is a variable (presumably read-only) that refers to 'number of fields' in this line. $NF dereferences to value of last field. You can also do tricky stuff like $(NF-2) I don't know do much Applescript, but there is some sort of construct like
set theVar equal to the last word in theOutput
which would probably do the same thing if you preferred. Hope that helps, RET

[ Reply to This | # ]