Interview Prep/Shell Scripting/Text processing: grep, sed, awk, cut, sort, uniq

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.

All Shell Scripting questions Roadmap: Shell scripting (Bash)

More on Text processing: grep, sed, awk, cut, sort, uniq