/var/tmp/exercise-two/Bob/has-bought/a-cow /var/tmp/exercise-two/Bob/has-bought/a-deer /var/tmp/exercise-two/Bob/has-bought/a-dog /var/tmp/exercise-two/David/is/a-tiger /var/tmp/exercise-two/David/is/a-tiger/fun /var/tmp/exercise-two/David/is/a-tiger/is /var/tmp/exercise-two/David/is/a-tiger/it則在你的 exer2 下建立如下對應的結構.
~/unix-1132/exer2
|---Bob
| `---has-bought
| |---a-cow
| |---a-deer
| `---a-dog
`---David
`---is
`---a-tiger
|---fun
|---is
`---it
$ ls -l
total 4
-r-xr--r-- 1 klim sys 290 Apr 15 19:57 ex6-sum.sh*
$ ./ex6-sum.sh
./ex6-sum.sh a b
$ ./ex6-sum.sh 1 5
6
$ ./ex6-sum.sh 1 6
6
$ ./ex6-sum.sh 1 9
6
$ ./ex6-sum.sh 1 11
17
$ ./ex6-sum.sh 12 11
0
$
$ cat IN
Time for dinner!
Time for lunch and it is time to go shopping.
time to sleep.
$
$ ./ex7-count.sh
./ex7-count.sh name
$ ./ex7-count.sh time < IN
time = 2
$ ./ex7-count.sh ime < IN
ime = 4
$ ./ex7-count.sh is < IN
is = 1
$ ./ex7-count.sh for < IN
for = 2
$ ./ex7-count.sh '.ime' < IN
.ime = 4
$
$ ./ex8-extract.sh
usage: ./ex8-extract.sh keyword [file] ....
$
$ ./ex8-extract.sh hi
hi it is good to see you
ohio aloha
damn i missed it
aloha good is it see to you
$
$ cat ex8-in-a
oak is not klim
klim is good
ok it is fine
$
$ ./ex8-extract.sh no < ex8-in-a
is klim oak
$
$ ./ex8-extract.sh 'o.*k' < ex8-in-a
fine is is it klim not
$
$ cat ex8-in-b
192390 klim
klim tooyoung
ok it is fine
$
$ ./ex8-extract.sh 'o.*k' ex8-in-a ex8-in-b
fine fine is is is it it klim not
$
--------prompt--> cat IN-9a
I got $100. I got 200.
oh! 300
oh so much $$$
another 10
$$
another 100
oh
$$$$$$$
too much 100000
--------prompt-->
--------prompt--> cat IN-9b
oh so much $$$$$$$
another 10
another 100
$$$
klim is not milk
$$$
0
$$$
200 is too good
oh
$$$$$$$
--------prompt-->
--------prompt--> ./ex9-sum.awk IN-9a
300
110
100000
--------prompt-->
--------prompt--> ./ex9-sum.awk IN-9b
110
0
200
--------prompt-->
$ cat IN-10
# this is a comment
joejoejoe 10 20 30 #this is also a comment
OAK -999 10 # 10000
joeJOE 2000
oak 10
milk 1000 # 2000
$ ./ex10.awk IN-10
OAK = -326.33
MILK = 1000.00
JOEJOE = 515.00
$