bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: errors in sed manual 4.2.2


From: Davide Brini
Subject: Re: errors in sed manual 4.2.2
Date: Sat, 9 Aug 2014 16:11:38 +0200

On Sat, 9 Aug 2014 14:13:46 +0100, 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.

Perhaps you haven't noticed that the program needs to be run with sed -n,
as shown in the shebang line. And in any case, why "s/.*//" and not just
"d"?

With sed -n, the program works fine.

> 
> Sections  4.9  and 4.10
> in S!{
>   h
>   b
> }
> add s/.*// after h
> omit final p

Same thing, you need to run with -n.

> 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

That's because you aren't running with -n.

Btw, a file without the newline character on the last line is not a
well-formed text file.


> 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

This is correct.


> 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

Run with sed -n and you'll get the the expected result.

-- 
D.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]