What do `tr`, `wc`, `head`, `tail`, `paste` and `column` do?
IntermediateConceptText processing: grep, sed, awk, cut, sort, uniq
Answer
tr '[:upper:]' '[:lower:]' < f # translate characters
tr -d '\r' < win.txt > unix.txt # delete characters
tr -s ' ' < f # squeeze repeated spaces
wc -l < f # line count (no filename)
head -n 20 f; tail -n 50 f; tail -F /var/log/app.log # -F follows across rotation
paste -sd, hosts.txt # join lines with commas
column -t -s, data.csv # align CSV as a table
tail -F (capital) reopens the file after log rotation; tail -f keeps reading the old, renamed file.
More on Text processing: grep, sed, awk, cut, sort, uniq
What are the most useful `grep` flags?BeginnerWhat is the difference between basic, extended and Perl regular expressions in grep?IntermediateWhat are the core `sed` commands you use in automation?BeginnerWhy does `sed -i` behave differently on macOS and Linux?IntermediateHow do you use variables inside a `sed` expression safely?AdvancedWhat is the structure of an `awk` program?Beginner