Here I collect useful text-processing commands. I don’t go into details. It’s just a convenient list to look up commands.

Sorting

cat file.txt | sort

Remove duplicate lines:

cat file.txt | sort | uniq

Count number of line occurrence:

cat file.txt | sort | uniq -c | sort -nr

First/Last Lines

head -n $numberOfLines file.txt
cat file.txt | head -n $numberOfLines

tail -n $numberOfLines file.txt
cat file.txt | tail -n $numberOfLines

Find Files

# all files:
find . -type f

Way more commands: https://tldp.org/LDP/abs/html/textproc.html

To be continued…