The arguments of "seq" indicate the starting value, step size, and the end value of the x-range. "awk" outputs (x, f(x)) pairs and pipes them to "graph", which is part of the "plotutils" package.
Displays six rows and five columns of random numbers between 0 and 1. If you need only one column, you can dispense with the "for" loop. Show Sample Output
This example calculates the averages of column one and column two of "file.dat". It can be easily modified if other columns are to be averaged.
Another combination of seq and awk. Not very efficient, but sufficiently quick. Show Sample Output
"seq 100" outputs 1,2,..,100, separated by newlines. awk adds them up and displays the sum.
"seq 1 2 11" outputs 1,3,..,11.
Variations:
1+3+...+(2n-1) = n^2
seq 1 2 19 | awk '{sum+=$1} END {print sum}' # displays 100
1/2 + 1/4 + ... = 1
seq 10 | awk '{sum+=1/(2**$1)} END {print sum}' # displays 0.999023
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: