sd icon indicating copy to clipboard operation
sd copied to clipboard

Fails to remove html tag

Open Vagelis-Prokopiou opened this issue 2 years ago • 7 comments

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.

Vagelis-Prokopiou avatar Oct 20 '22 07:10 Vagelis-Prokopiou

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

image

CosmicHorrorDev avatar May 11 '23 02:05 CosmicHorrorDev

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: image

Vagelis-Prokopiou avatar May 11 '23 06:05 Vagelis-Prokopiou

Thanks for verifying!

I'll try to get windows with git bash setup, so that I can dig in more

CosmicHorrorDev avatar May 11 '23 06:05 CosmicHorrorDev

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.

Vagelis-Prokopiou avatar May 11 '23 07:05 Vagelis-Prokopiou

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.

dev-ardi avatar Oct 20 '23 02:10 dev-ardi

There's a lot more discussion on this in #208

CosmicHorrorDev avatar Oct 20 '23 02:10 CosmicHorrorDev

export MSYS_NO_PATHCONV=1 solves it.

dev-ardi avatar Oct 22 '23 17:10 dev-ardi