0

For example:

for /F "taken=1,2* delims=;" %%i in(%TABLES%) do(
echo select %%j from %%i; | sed -e “s/,/||’,’||/g” -e “s/@/||’@’/g” >> %TABLES_OUT/¥%%i.sql

I want to replace string string instead of sed. Like this

, ➡︎ ||’,’||
@ ➡︎ ||’@

What should I do?

Mofi
  • 46,139
  • 17
  • 80
  • 143
tuetuetue
  • 1
  • 3

1 Answers1

0

The reference given by @Mofi is a good one. A significant part of it would be finding that VERTICAL LINE characters must be escaped with ^.

C:>TYPE replstr.bat
@ECHO OFF
SET "S=now,is,the@time,for@all"
ECHO %S%
SET "S2=%S:,=^|^|,^|^|%"
ECHO %S2%
SET "S3=%S2:@=^|^|@^|^|%"
ECHO %S3%

C:>CALL replstr.bat
now,is,the@time,for@all
now||,||is||,||the@time||,||for@all
now||,||is||,||the||@||time||,||for||@||all
lit
  • 14,456
  • 10
  • 65
  • 119