The Life Starter
0 of 6 complete0%
Course Library · Lesson 3 of 6
Digital · Guided lesson

Inspect text and count records

About 26 minutes · 6 reading + 20 practice and checks
Time includes reading, practice, and questions. Extra videos or further study are optional.
See this course’s project requirements

A repeatable Bash workflow with checked registration counts, a controlled rerun and clear handoff instructions.

Keep your working files in your own notebook or software. Save a private description, checklist, and work link in My Proof.

What to include

  • Location and path log.
  • Raw-row count with header handling.
  • Confirmed counts by session.
  • Reviewed script and dedicated output path.
  • Baseline/variation results and handoff.

Review and revise

Use these criteria to check your work and choose what to improve.

  • Paths and quoting are accurate.
  • Counts reconcile with the fixture.
  • Raw data is preserved.
  • Rerun and limitations are explained.
Open the full course project
Want more background?
Before you begin

The idea in everyday life

Summarize fictional workshop registrations using Bash and a small tab-separated file.

The idea

A line count counts text lines; you decide whether each line represents a data record.

Follow along

Inspect text and count records — guided practice

Distinguish lines including a header from data records.

Create an empty shell-lab folder. Inside it create input and output folders. Put registrations.tsv in input with these tab-separated rows and a final newline: session<TAB>status; art<TAB>confirmed; code<TAB>confirmed; art<TAB>waiting; code<TAB>confirmed; music<TAB>confirmed. Start the terminal in shell-lab. Bash required; no sudo, remote systems or deletion commands. Return to shell-lab before starting. Use the supplied file unchanged.

  1. 1. Read the file

    Print the complete file.

    cat input/registrations.tsv

    You should see: One header and five data rows appear.

    Knowing the structure prevents a misleading count.

  2. 2. Count all lines

    Run the line count.

    wc -l < input/registrations.tsv

    You should see: It reports 6 because the header is also a line.

    A tool measures its defined unit, not your intended business unit.

  3. 3. Exclude the header

    Print from line 2 onward and count.

    tail -n +2 input/registrations.tsv | wc -l

    You should see: The count is 5.

    The first line is field names, not a registration.

  4. 4. Compare

    Save a note: physical lines=6, registration rows=5.

    You should see: The difference is exactly one header.

    Explicit units make a summary understandable.

Now change one thing

A similar file has 9 newline-terminated lines, one header and no blanks. How many data rows?

Your work

What to finish

A checked row-count note.

Common mistake

Watch for this

Treating wc -l as a universal record count without checking headers or final newlines.

How can I tell I understand it?

Complete the changed case, explain your result, and pass the three application checks.

Try 3 questions

Quick knowledge check

Answer all 3 questions. Get at least 2 right and the lesson completes automatically.

Not yet passed

You’ll get an explanation for each answer. Signed in? Your results save to your account.

1A file has 11 lines including one header and two blank lines. How many nonblank data rows?
2wc -l reports 4 but you see five text lines and the final one lacks a newline. Why?
3Before subtracting one for a header, what should you inspect?
0 of 3 answeredApply the lesson to a short question, then review the explanation.
3
Finish this lesson

Pass the check. We’ll save the progress.

Answer all 3 questions above and get at least 2 right. You can review the explanations and try again.

Go to the knowledge check
Optional course overview video · same video as Lesson 1
Missing SemesterLecture 1: Course Overview + The Shell (2020)YouTube
Optional course overview

Lecture 1: Course Overview + The Shell (2020)

From Missing Semester. Watch here or open it on YouTube .

Optional course overview. Follow the written steps below at your own pace.
Tools, templates, and lesson sources

Tools and templates

Tools open in a new tab so you can keep your place here.

Sources and further reading

Explore the references behind this lesson.

Software Carpentry: Pipes and Filters
Source & access notes · checked 2026-09-12

Opened and inspected on 2026-09-12: Sorting, counts, pipes and redirection.

Access: Free public web page; no paid enrollment required.

Reuse: CC BY 4.0 instruction; MIT examples. Independent fixture used.

Report a problem with this lesson

Tell us what went wrong. Please leave out personal information and private project contents.

No sign-in needed.