sed: continue with the next command after n instead of starting a new cycle - #592
Open
DePasqualeOrg wants to merge 1 commit into
Open
DePasqualeOrg wants to merge 1 commit into
DePasqualeOrg wants to merge 1 commit into
Conversation
|
GNU sed testsuite comparison: |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #592 +/- ##
==========================================
- Coverage 83.86% 83.76% -0.11%
==========================================
Files 14 14
Lines 7203 7212 +9
Branches 424 428 +4
==========================================
Hits 6041 6041
- Misses 1157 1166 +9
Partials 5 5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
DePasqualeOrg
marked this pull request as ready for review
October 2, 2026 18:42
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Claude Code and Codex flagged this gap during my work with this project. The changes here have gone through extensive automated review. I'm happy to make changes as needed or close this PR and maintain it as a private patch if it doesn't meet your standards.
Fixes #568.
GNU sed's
nprints the pattern space unless-nis given, writes any text queued bya,rorR, replaces the pattern space with the next line of input, and continues with the command aftern. In uutils sed,nends the cycle instead, so the next line starts the script from the top. For example,printf '1\n2\n3\n4\n' | sed 'n;d'prints all four lines, while GNU sed prints1and3.This PR handles
nthe wayNalready works: it records the command to continue from, and when the next line has been read, processing resumes there with that line as the pattern space. If there is no next line, sed stops without running the remaining commands, as GNU sed does. Without-s,nreads the first line of the next file; with-sor-i, each file starts at the top of the script.codecov/patchandcodecov/projectfail only because CI does not count the coverage of tests that run the sed binary; they should pass after #591 is merged.