See Appendix A, Exercise Answers for answers.
Write a program to open the
/etc/passwd
file by name and print out the username, user ID (number), and real name in formatted columns. Use
format
and
write
.
Add a top-of-page format to the previous program. (If your password file is relatively short, you might need to set the pagelength to something like 10 lines so that you can get multiple instances of the top of the page.)
Add a sequentially increasing page number to the top of the page, so that you get
page
1
,
page
2
, and so on, in the output.