Raw data is rarely beautiful. It comes with trailing spaces, inconsistent casing, and unwanted characters.

The Sed Strike: Cleaning the Surface

To remove all trailing whitespace and change ‘ID:’ to ‘student_id:’, we use sed: sed -i 's/[[:space:]]*$//; s/ID:/student_id:/g' enrollment.txt

The Awk Strike: Rebuilding the Structure

Now, if we want to flip the ‘First Name, Last Name’ to ‘Last Name | First Name’ and capitalize the first letter, awk is our architect: awk -F, '{print toupper(substr($2,1,1)) substr($2,2) " | " $1}' students.csv

By the time the data reaches your Go application, it is pure, structured, and ready for work. This is the essence of the Textsmith’s craft.


Forged in the terminal. Refined under the anvil.