Shorter version using --tag
Might be more useful if you were able to print it in Days HH:MM:SS format as:
perl -e '@p=gmtime(234234);printf("%d Days %02d:%02d:%02ds\n",@p[7,2,1,0]);'
But I'm not exactly sure how to replace the 234234 with the output of the countdown time. (Having some problems with nested quoting/command substitution). Help would be appreciated :)
terms inclosing '()' must be enclosed by "" (soft quotes) bash variables must be referenced: b $x/$y ugly bracket checking (balanced, fractions...) default precision 2 Show Sample Output
If you want a sequence that can be plotted, do: seq 8 | awk '{print "e(" $0 ")" }' | bc -l | awk '{print NR " " $0}' Other bc functions include s (sine), c (cosine), l (log) and j (bessel). See the man page for details. Show Sample Output
Use bc for decimals...
Calculate pi from the infinite series 4/1 - 4/3 + 4/5 - 4/7 + ... This expansion was formulated by Gottfried Leibniz: http://en.wikipedia.org/wiki/Leibniz_formula_for_pi I helped rubenmoran create the sum of a sequence of numbers and he replied with a command for the sequence: 1 + 2 -3 + 4 ... This set me thinking. Transcendental numbers! seq provides the odd numbers 1, 3, 5 sed turns them into 4/1 4/3 4/5 paste inserts - and + bc -l does the calculation Note: 100 million iterations takes quite a while. 1 billion and I run out of memory. Show Sample Output
I simply find binary notation more straightforward to use than octal in this case. Obviously it is overkill if you just 600 or 700 all of your files... Show Sample Output
This was done in csh. Show Sample Output
Like in bash.
I did not come up with this one myself, but found this somewhere else several months ago. Show Sample Output
Converts from base 10 to base 16
The given file may contain any kind of characters. This is compatible for most simple mathematical operation. For the first number found, it will be replaced by the result of a factor operation of 1000. To change the filename or multiplactor or number regular expression, change the first fixed values. Show Sample Output
see summary. if you want to set dpi right away try this: xrandr --query | sed -n 's@\([A-Z0-1-]*\).* \(.*\)x\(.*\)+.*+.* \([0-9]\+\)mm x \([0-9]\+\)mm@"--output \1 --dpi ";(\2/\4+\3/\5)*12.7@p;'|bc -l|xargs -L1 xrandr all syntax should be POSIX compliant. Show Sample Output
This shell calculator uses POSIX features only and is therefore portable. By default the number of significant figures is limited to 8 with trailing zeros stripped, resembling the display of a basic pocket calculator. You might want to increase this to 12 to emulate a scientific calculator. Show Sample Output
This is the answer to the 0th problem from the python challenge < http://www.pythonchallenge.com/ >. Replace sensible-browser with firefox, w3m or whatever. Show Sample Output
This is an "argument calculator" funktion. The precision is set to 4 and you can use dot (.) or comma (,) as decimal mark (which is great for german users with a comma on the numpad).
bc is a wonderful calculator. Just type bc at the command line and have at it. Ctrl+D (or type quit) will get you out. This usage is just scratching the surface: bc can handle a mini scripting language, complete with variable, statements, loop, conditional statements and more. Do a man page on it to find out. Show Sample Output
Of course, this command must be executed at a GRID User Interface lhcb - name of your VO, substitute it with the one you are interested it. Show Sample Output
Probably more trouble than its worth, but worked for the obscure need.
Broken in two parts, first get the number of cores with cat /proc/cpuinfo |grep proc|wc -l and create a integer sequence with that number (xargs seq), then have GNU parallel loop that many times over the given command. Cheers! Show Sample Output
commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.
Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.
» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10
Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):
Subscribe to the feed for: