Weeks 12 - 15
Numbers, conditionals, more loops
Final exam --
(based on http://www.sru.edu/academics/academic-services/academic-records/class-and-final-exam-schedules )
Assignment #5 due date: Wednesday, April 11th
Second exam: Friday, April 13th
Assignment #6, due date: Wednesday, April 25th. Monday April 30th (Note: A new Part E, covering new topics has been added)
Assignment 6 will be the last homework assignment.
What we'll be doing these last weeks:
finishing up with awk: records in awk, passing parameters, more on parameters, a bit of awk arithmetic;
here's something new on brace expansion (including some remarks on tee and eval)
NOTE (Wednesday Dec. 6): based on question in today's class about searching for regular expression passed from command line see updated examples in passing parameters.
exercises:
- words whose letters are in alphabetical order (almost, biopsy, first, forty, etc.) -- how to find them?
- excerpting highest frequency words, by letter of the alphabet from threefull (/home/SRUNET/david.dailey/threefull)
- contrasting the frequency of letters in a) English text b) an English word list and c) an English word frequency list (weighting letters by the frequency of the words in which they occur)
- For each state and territory listed in /home/SRUNET/david.dailey/data/Gaz_places_national.txt, find the most populous city and output the results (showing city, state, and population) in order as ranked by city size.
- choosing a random letter (in {a..z} )
- choosing a random word (in /homes/ddailey/public_html/words )
- reversing the letters of each word in a line (so that "happy new year" -> "yppah wen raen")
(with or without looping? looping through letters or words?)- strategies for locating anagrams
- producing output like this
$ ./whippersnapper whippersnapperin which all pairs of letters are produced (so as to count digraphs)
wh,hi,ip,pp,pe,er,rs,sn,na,ap,pp,pe,er
- locating the ordinal position of the first matching character in a string
$ ./magic hamburger h
1
$ ./magic hamburger g
7- how to find the ordinal position within a string of the first match of a given substring?
$ ./magic2 voltmeter ete
6
$ ./magic2 voltmeter tm
4revisiting command line parameters and running commands in a file.
looking a bit more into looping as well as arithmetic and logic in shell scripts (also here)
and mastering a bit more: random numbers in UNIX shell and something about random numbers
see also: these notes involving seq and shuf
and, maybe, if you're really lucky, another case study -- leading to something like this .
Speaking of such and such: -- unity -> unify