|
From: | bamber ward |
Subject: | bug#20684: errors in sed manual 4.2.2 |
Date: | Thu, 28 May 2015 17:56:24 +0100 |
I have tried to construct examples to test out \`(backslash backtick) but have not succeeded in getting the responses I want. I assume that backtick is the same as backquote. Backticks as in `command`.for instance,echo cat | sed "s/\`cat/bingo/"gives catecho cat | sed "s/\`cat\'/bingo" # double quotes because of single quotegives catbutecho cat | sed "s/cat\'/=/" gives=On Sat, Aug 9, 2014 at 2:13 PM, bamber ward <address@hidden> wrote:
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
[Prev in Thread] | Current Thread | [Next in Thread] |