Forum: Forums topas RSS
Output a single quote into a file
Ivlev #1
Member since Feb 2020 · 2 posts · Location: Marburg, Germany
Group memberships: Members
Show profile · Link to this post
Subject: Output a single quote into a file
Hi all,

Is there any way at the moment to output a single quote (') into a file? After searching the forum I could find this topic dated 2011: http://topas.dur.ac.uk/unb/forum.…?req=thread&postid…

Best regards,
Sergei
AlanCoelho #2
Member since Aug 2011 · 323 posts
Group memberships: Members
Show profile · Link to this post
There's no way to do what you want from the INP file. You can however work around it as follows:

Output a special character (ie. £) instead of ' to the file you are writing to (lets call this out_file.txt)

From the command line, replace the special character using the following batch file (copy the following text to a file called rep.bat):


@echo off
REM -- Prepare the Command Processor --
SETLOCAL ENABLEEXTENSIONS
SETLOCAL DISABLEDELAYEDEXPANSION
::BatchSubstitude - parses a File line by line and replaces a substring"
::syntax: BatchSubstitude.bat OldStr NewStr File
::          OldStr [in] - string to be replaced
::          NewStr [in] - string to replace with
::          File   [in] - file to be parsed
:$changed 20100115
:$source https://www.dostips.com
if "%~1"=="" findstr "^::" "%~f0"&GOTO:EOF
for /f "tokens=1,* delims=]" %%A in ('"type %3|find /n /v """') do (
    set "line=%%B"
    if defined line (
        call set "line=echo.%%line:%~1=%~2%%"
        for /f "delims=" %%X in ('"echo."%%line%%""') do %%~X
    ) ELSE echo.
)


rep.bat is from DOStips.com. Here's how to use it:

   rep £ ' out_file.txt > out_file_new.txt

cheers
alan
Ivlev #3
Member since Feb 2020 · 2 posts · Location: Marburg, Germany
Group memberships: Members
Show profile · Link to this post
Dear Alan,

Thank you for the idea!

Best regards,
Sergei
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Go to forum
Not logged in. · Lost password · Register
This board is powered by the Unclassified NewsBoard software, 20150713-dev, © 2003-2015 by Yves Goergen
Current time: 2020-11-29, 13:36:31 (UTC +00:00)