shelljs / shelljs/shx

[sed] did not replace correctly

Open
#225 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

low priority sed
Dominant language
JavaScript
Stars
1.9k
Forks
51
Avg merge
3d 2h
Merged PRs (30d)
1

Description

With the following test.file:

[&_*]:foobar
"[&_*]:foobar"

With actual sed on macOS:

$ sed 's/\[\([^\&]*\)\&/\[\1\&/g' test.file
[&_*]:foobar
"[&_*]:foobar"

With shx sed:

npx shx sed 's/\[\([^\&]*\)\&/\[\1\&/g' test.txt                             
[&_*]:foobar
"[&_*]:foobar"

Node version: v20.12.2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the provided command with the example test.file and compare shx sed with macOS sed. Start by tracing shx's sed command entry point and its handling of the substitution expression, then verify that both lines produce the expected escaped ampersand output.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, shell
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.