About
A full implementation of the awk programming language, built for records and fields. Each line is split into columns, and patterns plus actions do the rest. Reach for it when the simpler column tools cannot express what you need.
Install it
pkg install gawk
Run this inside Termux. If the package is already present, pkg will say so and
do nothing.
Commands worth knowing
6 of the invocations you will actually reach for. Tap the copy button to put one on your clipboard.
awk {print $1, $3} data.txt Split each line on whitespace and print the first and third columns. awk -F: {print $1} users.txt Set the field separator to a colon and print only the first column. awk {sum += $2} END {print sum} sales.txt Add up a running total across every row, printed once at the end. awk $3 > 100 {print $0} report.txt Print whole lines only where the third column exceeds a threshold. awk NR==1 || $2 != prev {print} {prev=$2} log.txt Print the header and any row whose second column differs from the one before. awk {count[$1]++} END {for (k in count) print k, count[k]} log.txt Count how many times each value in the first column appears. Worked example
Run awk {print $1, $3} data.txt and this is what you should see.
$ awk {print $1, $3} data.txt
alice 42
bob 17
carol 88 Developed by
GNU Project .