$
Linux Practice
Practice
Tutorials
English
한국어
日本語
中文
terminal
Welcome to Linux Practice Terminal!
Type "help" to see available commands.
user
@linux:
~
$
cut (Text Extraction)
Reset Lesson
Extract specific columns and fields from structured text using cut.
Step 1
First, view the users.csv file to see its structure.
Type: cat documents/data/users.csv
cat documents/data/users.csv
Step 2
Extract the name column (field 2) using comma as delimiter.
Step 3
Extract both name and role columns (fields 2 and 4).
Step 4
Extract names and sort them alphabetically using a pipe.
Step 5
Count users by role: extract roles, sort, then count with uniq -c.