Skip to content

csplit: --suppress-matched incorrectly elides last empty file #7286

@jfinkels

Description

@jfinkels

Environment: Ubuntu 24.04, uutils main branch (git commit d86a7fb), GNU coreutils v9.6.16-3f7c3-modified

Steps to reproduce:

seq 6 | csplit --suppress-matched - 2 4 6

What happens now: uutils csplit prints

2
2
2

and produces three files:

  • xx00 with contents 1\n,
  • xx01 with contents 3\n,
  • xx02 with contents 5\n.

What I expected to happen: GNU csplit prints

2
2
2
0

and produces four files:

  • xx00 with contents 1\n,
  • xx01 with contents 3\n,
  • xx02 with contents 5\n,
  • xx03, an empty file.

Notes: this is causing a failure in GNU test file tests/csplit/csplit-suppress-matched.pl.

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions