207 Assignment Instructions (for typical assignments)

Illustrative examples
Here's a pretend assignment:
-------------------
Assignment #79

1. In a file that has two columns of data (separated by one or more space characters), show commands which succeed in reversing the order of the columns (while keeping the data intact within each column).

2. The file /home/SRUNET/david.dailey/words consists of several words, alphabetized, with one word per line, find all pairs of words for which both are words and for which the first word is the same as the second, but reversed. How many pairs of such words are there in /home/SRUNET/david.dailey/words?
-------------------
-------------------
Here's what your work (printed on paper for submission) might look like:


Assignment #79 -- submitted January 15 by Jambalaya Fishborne.

1. In a file that has two columns of data (separated by one or more space characters), show commands which succeed in reversing the order of the columns (while keeping the data intact within each column).

My original file (consisting of two columns of character data):
$cat temp
ag ms
bh nt
ci ou
dj pv
ek qw
fl rx
Reversing the order of the  columns: command and output
$awk '{print $2, $1}' temp
ms ag
nt bh
ou ci
pv dj
qw ek
rx fl


2. The file /home/SRUNET/david.dailey/words consists of several words, alphabetized, with one word per line, find all pairs of words for which both are words and for which the first word is the same as the second, but reversed.


The command I used to dump the words into a file (named backward):
for i in `cat words`; do echo -e $i"\n"`echo $i|rev`; done|sort|uniq -d>backward

The first and last five words in backward (output side-by-side to save paper):
$paste <(head -5 backward) <(tail -5 backward)
a       yam
abba    yap
abut    yard
aga     yaw
ah      yob

Demonstrating that these all remain words, when reversed. First, consolidating the words with their reversals:
~$for i in `cat backward`; do echo $i `echo $i|rev`; done|head
a a
abba abba
abut tuba
aga aga
ah ha
aha aha
alula alula
ana ana
anal lana
animal lamina
~$for i in `cat backward`; do echo $i `echo $i|rev`; done|tail
wolf flow
won now
wop pow
wot tow
x x
yam may
yap pay
yard dray
yaw way
yob boy

Second: demonstrating that the reversal of each word is, in fact, in the file backward:
~$for i in `cat backward`
> do
> grep ^$i$ backward
> done|wc
    282     282    1266
~$wc backward
 282  282 1266 backward


2. How many pairs of such words are there in /home/SRUNET/david.dailey/words?

Answer: 282 pairs of words (564 words, with each word counted twice):
~$for i in `cat backward`; do echo $i `echo $i|rev`; done|wc -lw
    282     564