`csplit` should always suppress lines based on line numbers
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 24.1k
- Forks
- 2k
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 365
Description
csplit has multiple ways to split files: based on regex, line numbers and more. The examples in this issue use this file:
seq 1 50 > 50.txt
If we use multiple line numbers in the wrong order, we get an error (both in uutils and GNU):
> csplit 50.txt 20 10
csplit: line number '10' is smaller than preceding line number, 20
So far so good. But, if we use a regex first and then a line number that is smaller than the number of the line where the regex matched we get in trouble:
# GNU
> csplit 50.txt /10/ 5 --suppress-matched
18
0
117
# uutils
csplit 50.txt /10/ 5 --suppress-matched`
18
0
120
The reason is that we seem to make a distinction between the less than and the equal case to determine whether the line should bee suppressed, but GNU doesn't.
cc @BenWiederhake
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the csplit implementation and its handling of regex matches, line-number operands, and --suppress-matched. Reproduce the commands from the issue and inspect existing csplit tests if available. Done means the mixed regex and decreasing line-number case suppresses lines with the same behavior as GNU csplit.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100