On Wed, Sep 14, 2022 at 12:40:55AM +0200, Luka Krmpoti?? wrote: > sed's man(1) page, section "sed addresses", has a note: > > https://github.com/openbsd/src/blob/16748403c325ab5b4e9457bf8f0879a6698daba9/usr.bin/sed/sed.1#L175-L176 > > (If the second address is a number less than or equal to the line number > first selected, only that line is selected.) > > to me, this makes it sound as if the second address would be selected, > so as if in the range `3,1` line 1 would be selected, when in actuality it > is line 3 > ```ksh > $ sed -n 3,1p <<EOF > > one > > two > > three > > EOF > three > ``` > I recommend the note to be made clearer, by being explicit about "that line" > > (If the second address is a number less than or equal to the line number > first selected, only the first address is selected.) > > Best, > Luka > > P.S. > it is after midnight here
hi. i rather think i agree. diff below to address that. in addition, i don;t think it helpes having that entire sentence in brackets, so i removed them. will let this sit a little in case of feedback. jmc Index: sed.1 =================================================================== RCS file: /cvs/src/usr.bin/sed/sed.1,v retrieving revision 1.61 diff -u -p -r1.61 sed.1 --- sed.1 3 Aug 2022 08:16:50 -0000 1.61 +++ sed.1 14 Sep 2022 05:47:07 -0000 @@ -172,8 +172,8 @@ that match the address. A command line with two addresses selects the inclusive range from the first pattern space that matches the first address through the next pattern space that matches the second. -(If the second address is a number less than or equal to the line number -first selected, only that line is selected.) +If the second address is a number less than or equal to the line number +first selected, only the first line is selected. Starting at the first line following the selected range, .Nm starts looking again for the first address.