awk | Cheatsheet¶
AWK is an interpreted programming language that is generally used to make shell scripts more powerful and feature-rich. It is mostly used to process data in text and file operations.
The name comes from the first letter of the surname of each of the creators: Alfred Aho, Peter Weinberger and Brian Kernighan.
This language is considered by many to be an important milestone in the history of programming, having had a great influence on the creation of other programming languages, such as Perl and Python.
Execute 4 commands at every second¶
time awk '{
buffer = buffer $0 ORS # Store the current line in a buffer
count++ # Increment the counter
if (count % 4 == 0) { # When the counter reaches 4
print buffer # Output the buffered lines
buffer = "" # Reset the buffer
}
}
END {
if (buffer != "") # Output any remaining lines
print buffer
}' 100.rader.txt