bamber ward
2014-08-09 13:13:46 UTC
Unfortunately, errors in the documentation seem to persist. Somewhat
disapointing but correcting
bugs is, I find, a good way to really understand a language.
Section 4.7
add
s/.*// after last h
to see why just run the program as given in the manual.
Sections 4.9 and 4.10
in S!{
h
b
}
add s/.*// after h
omit final p
without these changes you get, for
a file containing,
the cat sat
on the mat # no new line here
baa
23
23
instead of 23
4.15
I see you have added the -n option to this edition to try to correct this
script.
However, the comment in the script should state print the second(not first)
duplicated line
The program still does not give the correct output
cat uniq_d3.txt
dog
dog
cat
cat
pony
gives output:
dog
cat
cat
pony
instead of :
dog
cat
The script prints out the last line regardless and if the last two lines
are different it prints both.
Replacing the last $b by
$ s/.*/ / seems to fix it
Possibilities
Last two lines different.Can't be duplicates so delete
Last two lines duplicates.
Last line added in the code block.
Last but one line deleted
Then Last line printed so ok to delete pattern space at end.
4.17
Need to remove the first p in the last script to avoid duplicated output
I hope you find this helpful
Best Wishes
David
disapointing but correcting
bugs is, I find, a good way to really understand a language.
Section 4.7
add
s/.*// after last h
to see why just run the program as given in the manual.
Sections 4.9 and 4.10
in S!{
h
b
}
add s/.*// after h
omit final p
without these changes you get, for
a file containing,
the cat sat
on the mat # no new line here
baa
23
23
instead of 23
4.15
I see you have added the -n option to this edition to try to correct this
script.
However, the comment in the script should state print the second(not first)
duplicated line
The program still does not give the correct output
cat uniq_d3.txt
dog
dog
cat
cat
pony
gives output:
dog
cat
cat
pony
instead of :
dog
cat
The script prints out the last line regardless and if the last two lines
are different it prints both.
Replacing the last $b by
$ s/.*/ / seems to fix it
Possibilities
Last two lines different.Can't be duplicates so delete
Last two lines duplicates.
Last line added in the code block.
Last but one line deleted
Then Last line printed so ok to delete pattern space at end.
4.17
Need to remove the first p in the last script to avoid duplicated output
I hope you find this helpful
Best Wishes
David