Use the following command in a terminal:
$ cat /proc/version
20 Wednesday Oct 2010
10 Saturday Apr 2010
29 Friday Jan 2010
Tags
calculator, cli, math, trigonometry, zsh
$ zmodload zsh/mathfunc $ echo $(( sin(1/4.0)**2 + cos(1/4.0)**2 - 1 )) -1.1102230246251565e-16 $ echo $(( pi = 4.0 * atan(1.0) )) 3.1415926535897931 $ echo $(( f = sin(0.3) )) 0.29552020666133955 $ print $((1e12 * rand48())) 847909677310.23413 $ print $(( rand48(seed) )) 0.0104348833470027
Notice that zsh/mathfunc must be loaded first!
Credit: copied from zsh-lovers.
28 Thursday Jan 2010
14 Thursday Jan 2010
As an example, the following displays every first line and every 3rd line after that in a file file.txt:
$ awk 'NR%3==1' file.txtSo, if file.txt has 1 in the first line, 2 in the second and so on, then the above command will display 1 in the first line, 4 in the second, 7 in the third line and so on until it reaches the end of the file.