16 Commits (master)

Author SHA1 Message Date
Igor Chubin adfdf75cb7 Add: awk paragraph search, separated output 2 years ago
Altynbek Isabekov 527f4b1a77 Update Awk cheat sheet 2 years ago
terminalforlife db9d405385 Add super-awesome AWK example 3 years ago
terminalforlife 9f2dcacb25 Tweak and/or add to awk 4 years ago
terminalforlife 489af58ee9 Add nifty Awk trick to fetch the total RAM 4 years ago
terminalforlife 2ce193c0ba Fix typos, tidy formatting, & improve writing
This is what late-night boredom does to you. lol
4 years ago
terminalforlife 36b9feb0a2 Add pretty-print output taken from `/etc/passwd` 5 years ago
terminalforlife 09e06fc821 Add syntax for fetching lines between patterns 5 years ago
terminalforlife 0b61d3884e Fetch unique list of uppercase-only variables
Just wrote this because I'm wanting to convert numerous uppercase
variables in lots of shell programs to lowercase, except the initial
letter of a word. Manually, doing this would take forever.

First, however, I need to compile a list of variable names so I know
for what I want to search and replace, then omit certain ones typically
named in all uppercase, like `UID`, `USER`, `HOSTNAME`, etc, which I
will probably do by parsing `env` and various other special parameters
used by Bash.

Fun times.
5 years ago
terminalforlife 81711828bc Add more examples using associate array variables 5 years ago
terminalforlife 9c6e04b5c0 Add line to list unique DEB sections, using awk 5 years ago
terminalforlife c12d8e2df2 Show counting lines awk reads from STDIN
This is useful, but not if this is _all_ you're after; in those
cases, you're better off just using `free | wc -l` or similar.

However, there may be times you need to count the number of lines in
order to achieve _other_ things programmed in awk, which would then be
crucial!

For example, you may wish to output text informing the user of how many
log entries were discovered in one or more files given to awk.
5 years ago
terminalforlife ff4af91485 Access environment variables from within awk.
ENVIRON is a special associative array variable, and LS_COLORS is an
index therein. If you want to see the available variables you could
use, you could execute the trusty `env` command.
5 years ago
terminalforlife fec416c763 Show using awk without data via STDIN
This is useful for those times you want to just do something in awk, -
on-the-fly, without having to rely on its standard input (STDIN).

It's especially handy when you want to perform floating-point
arithmetic, if you're not a shell like ZSH which does support it.
5 years ago
Mariusz Błaszczak e388d3bfb5
awk: how to display only first column of text with
It might be useful e.g. when removing docker containers:
docker ps -a | grep openeir | awk '{print $1 }' | xargs docker rm
5 years ago
Igor Chubin b11cc92cd9 added awk 6 years ago