Text processing
Search, cut, sort and transform text with grep, cut, sort and awk.
What you will be able to do
- Use grep -i for case-insensitive search.
- Use cut -d and -f for delimited fields.
- Use sort then uniq -c for counts.
- Use awk for field-based reports.
In plain English
Most operations work is text. grep finds lines, cut extracts columns, sort orders them, uniq removes duplicates and awk handles fields and arithmetic. Learn the five and you stop opening a spreadsheet for simple questions.
printf 'css,18\nhtml,12\ncss,22\n' > minutes.csv
cut -d, -f1 minutes.csv | sort | uniq -c
awk -F, '{ total += $2 } END { print total }' minutes.csvYour turn
MediumSum a column
Sum the second comma-separated column of minutes.csv using awk.
BASH · starter
awkCheck your understanding before moving on.
Knowledge checkQuestion 1
Which command counts duplicate lines after sorting?
Select an answer to continue
Study tools
Make it yours.
Keep a private note for this lesson, then turn the key ideas into flashcards you can revisit.
Sign in to save notes and flashcards.Both are private to your account and stay with your progress.
Sign inFinished reading?
Lock in what you just learned.
0%
Mark this lesson complete to save your place and move one step closer to the certificate.