It's basically a full-blown programming language, designed to deal with text files one line at a time, and it's really useful it's also something you can pick up a little bit at a time, if you're so inclined. 4.0 Based on 31 user rates Read reviews & comments Follow this app Developer website GeekTool overview GeekTool lets you display various kinds of information on your desktop via 3 default plug-ins. Type "man awk" in the terminal for a full description of the command. Download GeekTool for Mac MacUpdate Home Customization Desktop GeekTool GeekTool Version 3.3.1 Display log files, UNIX command output, and more. If max is not greater than zero, then something wrong happened (maybe ioreg doesn't have a line which says "MaxCapacity") and so return the character "?". If the variable max is greater than zero, then take the contents of the array labelled "CurrentCapacity", divide it by max, and multiply by 100. Next it prints out the result of the formula max>0?100*c/max:"?"which is an if-then statement (with the form test?true:false awk stole this notation from C). Second, it defines the variable max to be the contents of the array labelled "MaxCapacity" (which was defined in the first part of the process). First it sets OFMT="%.2f%%", which means to change the output format so that it outputs real numbers with two decimal places followed by a percentage sign (as above). The problem with GeekTool is that it requires output from a command that is static. The END segment means to run the following command after you're done reading in standard input. (Unlike in some languages, awk's arrays can be labelled with text, not just numbers.) Whenever column 3 ($3) contains the word "Capacity" ($3~/Capacity), it runs the command "c=$5", which stores the fifth column into an array (a box) labelled with the contents of the third column. This awk command starts by reading in each line of ioreg -l, one at a time. We showed you how Geektool lets you show system information in style. GeekTool is an application for Mac OS 10.6+. Free app Nerdtool is a piece of software you can use to turn that empty space behind your windows into something functional and beautiful. The printf command calculates $10/$5*100 (that is, the 10th column divided by the 5th column, times 100) and prints it as a floating-point number with 2 decimal places ("%.2f") followed by a percentage sign ("%%").Īwk '$3~/Capacity/ ' Add whatever information you want to your Mac's desktop, and make it look great. (So $5 is the 5th column's data and $10 is the 10th column's). This first awk command reads the standard input, one line at a time (if necessary I'm guessing only one line is being sent to it here), and splits the line into columns, the data in column c having the name $c.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |