Linux Text Manipulation Toolkit: Beyond grep and sed
grep and sed cover the basics, but the real power comes from combining them with cut, tr, sort, and uniq. Here is my everyday toolkit. Text manipulation is the skill I use most on the Linux command line. Logs, config files, CSV exports, command output. everything is text, and the Unix toolkit is designed to transform it. For years I used grep and sed for everything, reaching for Python when the task got complex. Once I learned the broader toolkit and how to combine the tools, I stopped reaching for Python for most text tasks. The shell pipeline is faster, more composable, and often a single line where Python needed a script. cut for Fixed and Delimited Fields The cut command extracts fields from lines. For delimited files like CSV, -d sets the delimiter and -f selects the field. For fixed-width files, -c selects character ranges. I use cut when I need a specific column and the format is consistent. # Extract the username field from /etc/passwd cut -d: -f1 /etc/passwd # Get characters 1 through 10 from each line cut -c1-10 file.txt # Get fields 2 and 4 from a CSV cut -d, -f2,4…