Skip to content

g and G discrepancy when the patten space is not set #266

Open

Description

@e-kwsm

c6479b4

$ seq 3 | cargo run --quiet -- -e '2g'
1
3
$ seq 3 | cargo run --quiet -- -e '2G'
1
2
3

GNU and BSD sed’s:

$ seq 3 | sed -e '2g'
1

3
$ seq 3 | sed -e '2G'
1
2

3

POSIX:

[2addr]g
Replace the contents of the pattern space by the contents of the hold space.
[2addr]G
Append to the pattern space a followed by the contents of the hold space.

If the hold space is not null e.g. 1h;2g, all of them behave in the same way.

Activity

  1. e-kwsm commented on Jan 18, 2026

    @e-kwsm
    Author
  2. changed the title [-]`g` and `G` discrepancy when the patten space is not set[/-] [+]`x`, and `g` and `G` discrepancy when the patten space is not set[/+] on Jan 18, 2026
  3. e-kwsm commented on Feb 13, 2026

    @e-kwsm
    ContributorAuthor

    g and G still (fee1ff3) behave differently from GNU and BSD.

  4. reopened this on Feb 13, 2026
  5. changed the title [-]`x`, and `g` and `G` discrepancy when the patten space is not set[/-] [+]`g` and `G` discrepancy when the patten space is not set[/+] on Feb 13, 2026
  6. LoukasPap commented on Feb 19, 2026

    @LoukasPap
    Contributor

    @e-kwsm This is solved in PR 263.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions