[Bug 252743] rs(1) with -C adds spurious trailing separator
bugzilla-noreply at freebsd.org
bugzilla-noreply at freebsd.org
Sat Jan 16 16:11:12 UTC 2021
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=252743
Bug ID: 252743
Summary: rs(1) with -C adds spurious trailing separator
Product: Base System
Version: Unspecified
Hardware: Any
OS: Any
Status: New
Severity: Affects Some People
Priority: ---
Component: bin
Assignee: bugs at FreeBSD.org
Reporter: freebsd at tim.thechases.com
To reproduce:
$ jot 3 | rs -C,
Expected output:
1,2,3
Actual output:
1,2,3,
(note the trailing comma)
_________________________________
By default, rs(1) will strip trailing delimiters:
$ jot 3 | rs
1 2 3
$ jot 3 | rs | hexdump -C | head -1
00000000 31 20 20 32 20 20 33 0a |1 2 3.|
and `rs -m` will properly preserve them:
$ jot 3 | rs -m | hexdump -C | head -1
00000000 31 20 20 32 20 20 33 20 20 0a |1 2 3 .|
(note the additional two hex "20" space values).
Similarly, the -S$DELIM option properly strips trailing delimiters while `-m`
keeps them:
$ jot 3 | rs -S,
1,,2,,3
$ jot 3 | rs -mS,
1,,2,,3,,
However, when specifying an output delimiter with -C, it doesn't strip the
trailing delimiter:
$ jot 3 | rs -C,
1,2,3,
That's the output I would expect from `rs -mC,` to maintain a trailing
delimiter:
$ jot 3 | rs -C, -m
1,2,3,
as the man-page for rs(1) says
> -m Do not trim excess delimiters from the ends of the output array.
suggesting that trailing delimiters (including those from `-C`) should be
trimmed unless `-m` is specified.
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the freebsd-bugs
mailing list