TPipe: Replacing String with Double Quotes

Nov 20, 2015
2
0
#1
Hi, I am trying to add some configuration options to a bunch of files with the help of tpipe. The files look like this

[..]
// Verzeichnis für Content: 'Finanzamts Bericht'
CONTENT_DIRECTORY_FINANZAMT_BERICHT = "/home/vamosusr/exporte/export_finanzamtsbericht_oesterreich";

[..]

and I want to add some lines like this ..

[..]
// Verzeichnis für Content: 'Finanzamts Bericht'
CONTENT_DIRECTORY_FINANZAMT_BERICHT = "/home/vamosusr/exporte/export_finanzamtsbericht_oesterreich";
CONTENT_DIRECTORY_FINANZAMT_DEUTSCHLAND_EXKLUSIVVERMITTLER = "/home/vamosusr/exporte/export_finanzamtsbericht";

[..]

so I tried something like this:

for /r %file in (*gsprovision.cfg) tpipe /input=%file /output=%file /replace=4,1,0,0,0,0,0,0,0,"CONTENT_DIRECTORY_FINANZAMT_BERICHT = ./home/vamosusr/exporte/export_finanzamtsbericht_oesterreich.;","CONTENT_DIRECTORY_FINANZAMT_BERICHT = \"/home/vamosusr/exporte/export_finanzamtsbericht_oesterreich\";\n\t\tCONTENT_DIRECTORY_FINANZAMT_DEUTSCHLAND_EXKLUSIVVERMITTLER = \"/home/vamosusr/exporte/export_finanzamtsbericht\";"

and for each file in the wildcard search I get:

TPIPE: Trailing \ needs to be followed by something

It seems, that tpipe is not recognizing the escaped double quote in the replace part.

Any suggestions?

Greetings from Germany and thanks in advance,

Thorsten.

P.S.: Double Escaping like (\\\") doesn't work either.
 
Last edited:
#2
I don't think you should be escaping the double-quote in the replacement string; it's not a pattern. The first below (simplified) apparently does what you want. The second, with forward slashes added to the strings, generates an error. That may be a bug, or something about TPIPE that I don't understand. As far as I know forward slashes should be ordinary characters.
Code:
v:\> echo a = "b"; | tpipe /replace=4,0,0,0,0,0,0,0,0,"a = \"b\";","a = "b"\;\n\t\td = "e";"
a = "b"\;
  d = "e";

v:\> echo a = "b/c"; | tpipe /replace=4,0,0,0,0,0,0,0,0,"a = \"b/c\";","a = "b/c"\;\n\t\td = "e/f";"

TPIPE: The parameter is incorrect.
 ""a = \"b"
 
Nov 20, 2015
2
0
#3
Hello Vince,

thanks for your answer. Unfortunately it doesn't seem to work in my case:

Code:
[C:\_ws\Tortoise\targets]for /r %file in (*gsprovision.cfg) tpipe /input=%file /output=%file /replace=4,1,0,0,0,0,0,0,0,"CONTENT_DIRECTORY_FINANZAMT_BERICHT = ./home/vamosu
sr/exporte/export_finanzamtsbericht_oesterreich.;","CONTENT_DIRECTORY_FINANZAMT_BERICHT = "/home/vamosusr/exporte/export_finanzamtsbericht_oesterreich";\n\t\tCONTENT_DIRECT
ORY_FINANZAMT_DEUTSCHLAND_EXKLUSIVVERMITTLER = "/home/vamosusr/exporte/export_finanzamtsbericht";"
replaces

Code:
 // Verzeichnis für Content: 'Finanzamts Bericht'
 CONTENT_DIRECTORY_FINANZAMT_BERICHT = "/home/vamosusr/exporte/export_finanzamtsbericht_oesterreich";
with

Code:
// Verzeichnis für Content: 'Finanzamts Bericht'
CONTENT_DIRECTORY_FINANZAMT_BERICHT =
This may be because of the forward slash "bug", since the first character after the double quote is a forward slash.

Greetings,

Thorsten.
 
#4
A couple of difficulties were ironed out in TCC version 19 (public beta now available). You can now protect TPIPE option parameters with strong quotes ... for example /relpace=`...`. And an unfortunate interaction with the forward slash (/) has been eliminated. If you haven't yet resolved this issue, you might try to get your original construction working with TCC v19, capitalizing on these enhancements.