terminal
Welcome to Linux Practice Terminal!
Type "help" to see available commands.
user@linux:~$
Advanced Text Processing
Build complex pipelines with head, tail, grep, and wc for multi-stage text processing.
Step 1
Review: pipe cat output through grep to find ERROR lines.
Type: cat documents/log.txt | grep ERROR
cat documents/log.txt | grep ERROR
Step 2
Pipe the log file to head to see only the first 3 lines.
Step 3
Extract lines 4-5: pipe through head -n 5 then tail -n 2.
Step 4
Count INFO lines using a 3-stage pipeline: cat | grep | wc.
Step 5
Use ls | grep to filter directory listing for "txt" files.
Step 6
Count how many txt files are in documents.
Step 7
Use grep -n in a pipe to find WARN lines with line numbers.
Step 8
Count non-INFO lines using grep -v in a pipeline.
Step 9
Save pipeline output to a file: pipe grep results to errors.txt.