sd
sd copied to clipboard
Fails to remove html tag
The following fail:
sd '</span>' '' file.txt
sd -s '</span>' '' file.txt
The respective sed
command works:
sed 's|</span>||g' file.txt
Platform: Windows sd version: 0.7.6 Executed from within Git Bash.
PS: I also tried various combinations with escaping the special characters, but nothing worked.
I'm not able to repro this with v0.7.6 on Linux. Let me know if you're still able to reproduce this and if other replacements also fail
Hi @CosmicHorrorDev. Yes. Still reproducible (sd 0.7.6).
As I said, this is reproducible on Windows, through Git Bash.
The following do not work.
echo -n '<span>Hi</span>' | sd '</span>' ''
echo -n '<span>Hi</span>' | sd -s '</span>' ''
echo -n '////' | sd '/' ''
The following work:
echo -n '<span>Hi</span>' | sed 's|</span>||'
echo -n '////' | sed 's|/||g'
See the image:
Thanks for verifying!
I'll try to get windows with git bash setup, so that I can dig in more
I have an intuition that it may be related to the /
character.
This character has also given me problems with other tools too (see https://github.com/BurntSushi/ripgrep/issues/1973).
The questions though is, why do sed and grep work, whereas sd and rg don't?
It is interesting.
for some reason /foo
expands to "C:/Users/user/AppData/Local/Programs/Git/foo"
. This is some weird git bash behaviour, might be a clap bug.
There's a lot more discussion on this in #208
export MSYS_NO_PATHCONV=1
solves it.