|
|
Regular ExpressionsDue: End of Friday LabAppendix ARead Appendix A and do these exercises:
$ sed -e '...your expression here...' /etc/passwd | more
$ ypcat passwd | sed -e '...your expression here...' | more
The output should have the first two fields of the passwd file exchanged.
ian@algonquincollege.com (Ian D. Allen)
decb0012@algonquincollege.com (Smart Student)
abcd0001@algonquincollege.com (Student, Brainy)
Don't worry about fixing the last name / first name order problems that some names have. Just use the name as it appears. $ ypcat passwd | sed -e '...your expression here...' | more
The output should be the passwd file with all names appearing in
"Firstname Lastname" order, without commas.
ian@algonquincollege.com (Ian D. Allen)
decb0012@algonquincollege.com (Smart Student)
abcd0001@algonquincollege.com (Brainy Student)
You might do this in one regular expression; or, you might find it simpler to run the passwd file through a "name exchange" filter first, then through a "mail address" filter using Unix pipes. Hand in your command lines along with the first few lines of output from each command line. (Don't submit the entire password file, please. Give just enough output to show that your regular expression works.) |