regex - Cywgin Sed match not working when "/" in string -
testline="this test line: asia/pacific australia" expr="asia\/pacific australia" this works:
echo "$testline" | sed 's/asia\/pacific australia/test/g' this not:
echo "$testline" | sed 's/$expr/test/g' i've tried using multiple "escapes", using different quote marks, using -r , -re sed switches. nothing seems work.
please advise if has working solution. please can advise , provide cygwin output here, many thanks!
first change variable as
expr="asia/pacific australia" this should work then
echo "$testline" | sed 's_'"$expr"'_test_g' note sed delimiters can choose other chars well, here _
Comments
Post a Comment