man bash
man awk
man sed
man grep
You can also do most of this stuff with Perl one liners if that suits your fancy.sed + awk - https://www.amazon.com/sed-awk-Dale-Dougherty/dp/1565922255
awk - https://ia802309.us.archive.org/25/items/pdfy-MgN0H1joIoDVoI...
general *nix text processing - https://www.tldp.org/LDP/abs/html/textproc.html