Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 5028
  • Last Modified:

double quote (") in delims list !!!

I want to parse a file and use the double quote (") as a delimiter...but I cannot
use the line like :

FOR /F  "eol=; tokens=1* delims=""

because the options are already between double quotes and this is causing a syntax error !

How can I manage that ??

Thanks in advance for your help.

GgZ
0
ggz
Asked:
ggz
1 Solution
 
dimitryCommented:
I think you can use double quote:
for /F  " eol=; tokens=1* delims="" "
0
 
SteveGTRCommented:
I couldn't get the for statement to accept the double quote. I tried a number of things including escaping it (^") and using double quotes (""). Neither worked, but you might consider this:

@echo off

for /F "delims=" %%f in (test.dat) do (
  set lineinfo=%%f
  call :PROCESS
)

set lineinfo=

goto EXIT

:PROCESS

set test=%lineinfo:"=*%

REM ** Here is where you'd do your processing
for /F "eol=; tokens=1,* delims=*" %%f in ('echo %test%') do echo %%f %%g

set test=

:EXIT

You can transform the double quote to another character. I used an asterick.

Good Luck,
Steve
0
 
ggzAuthor Commented:
Many thanks Steve, your solution is working :-D
0

Featured Post

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now