Counting and Cutting
Counting and Cutting: Count, Sort, Remove Duplicates: wc, sort and uniq, Columns and Characters: cut and tr, Tee and Xargs: Splitting and Feeding.
Updated
- Count, Sort, Remove Duplicates: wc, sort and uniq (Apprentice): wc counts lines, words and characters, sort puts lines in order, as text or with -n as numbers, and uniq merges repeated lines that sit next to each other, so sort | uniq -c | sort -rn ranks how often each line appears.
- Columns and Characters: cut and tr (Apprentice): cut keeps the columns you name with -f, splitting each line at the delimiter you give with -d (or keeps character positions with -c), and tr changes characters one for one, such as capitals into lowercase, or deletes them with -d.
- Tee and Xargs: Splitting and Feeding (Journeyman): tee saves what flows through a pipe into a file and passes it on, so you can keep a report and read it at once, and xargs turns the lines it reads into arguments for commands such as mkdir and rm, which don't read a pipe.