Signal9Signal9 — home
online
back to labs

Pipeline: Extract & Transform a CSV

EasyLinux Fundamentals15-20 min
The brief

A user roster sits at /root/users.csv in the form name,email,role — with a HEADER line you must skip. Reshape it three ways, writing each result under /root/answers/ (already created):

1. emails.txt — every user's email (column 2), sorted alphabetically, one per line. Skip the header.

2. roles.txt — the distinct roles (column 3), UPPERCASED, sorted, one per line (e.g. ADMIN / GUEST / USER).

3. admins.txt — a single number: how many users have exactly the role 'admin'.

The tools: tail -n +2 (drop the header), cut -d, -f N (pull a column), tr a-z A-Z (uppercase), sort / sort -u (order / dedupe), grep -c (count matches). Snap them together with pipes.

What you'll do
  • Extract and sort the email column into emails.txt (header skipped)
  • Extract, uppercase, and dedupe the role column into roles.txt
  • Count the users whose role is exactly 'admin' into admins.txt

Hands-on lab: you work on a real Linux box in your browser, graded on the machine's actual state.