------------------------------- Week 4 in-lab exercise solution ------------------------------- -Ian! D. Allen - idallen@idallen.ca The question I posed in the lab this week was: Extract lines 15-25 from the password file and display it in sorted order. Save the output to file week4.txt and submit it using datsubmit 24. Solution: As shown in the lab, we start by getting the first 25 lines of the file: $ head -25 /etc/passwd If the above output seems correct, we then extract the last 11 lines (there are 11 lines from 15-25): $ head -25 /etc/passwd | tail -11 If the above output seems correct, we sort the 11 lines: $ head -25 /etc/passwd | tail -11 | sort If the above output seems correct, we save it and submit it: $ head -25 /etc/passwd | tail -11 | sort >week4.txt $ datsubmit 24 week4.txt References: Notes file redirection.txt - Unix Shell I/O Redirection (including Pipes) Learning Unix: Chapter 5 p.87 Running Linux: Chapter 4 p.93 "Saving Your Output"