9.334 programming

Humanist (mccarty@phoenix.Princeton.EDU)
Wed, 29 Nov 1995 18:43:21 -0500 (EST)

Humanist Discussion Group, Vol. 9, No. 334.
Center for Electronic Texts in the Humanities (Princeton/Rutgers)

[1] From: R.B.Hardy@ukc.ac.uk (34 )
Subject: Re: 9.328 programming

I teach first-year Humanities students at the University
of Kent at Canterbury various computer skills. These
students are not going to take another course in
computing skills. They are headed towards various majors,
none of which includes a computing component.

This week they are taking a test which involves them
tidying up a data file thus:

sed 's/[ ][ ]*/ /' filename | sed 's/^[ ][ ]*//' |
sed 's/[ ][ ]*$//' | uniq > targetfile

(There is an extraneous return in the command line for obvious

I have engaged in a bit of simplification in the above command line,
because the real test involves the use of sort.

There are some students who use sort options to achieve the
desired effect, and pass the test thereby.

(There are many other tests, involving many other areas of

90% of the students are 18/19 years old. The course I teach
officially takes up one-eighth of their first year. In
actuality, probably less.

Tags? Give these students Unix, your tag problems, a
chart of metacharacters, and some money, pin money.
Dead cinch.

(Now Perl, there's a challenge. Perl for first year

Roger Hardy
Lecturer in English and American Literature
University of Kent at Canterbury

[who hopes he didn't make any mistakes in his non-executable-file
command line!!!]


The test, slightly changed:

Sort, one one command line, and on the surname, the following
`file' so as to remove redundancies:

Robert Jones 32 Parkside Avenue
Sylvia Hart The Glades
Mervin Pluss The Houseboat
Robert Jones 32 Parkside Avenue
Melvin Pluss The Houseboat
Sylvia Hart The Glades

Hint: try an octal dump (od -bc) on the extracted lines,
(and, if you're just learning, on the command line
in the previous mailing, after you've extracted it
and removed the `return'.)

Roger Hardy