Page 1 of 1

Google SERP minus quotes

Posted: 31 May 2009 23:52
by mungurk
Hello,
I have read through previous postings on stripping quotes, but cannot seem to get my batch to remove the quotes.

I have a script that prints a Google URL to a TXT file:

set str="http://www.google.com/search?hl=en&as_q=canada&as_epq=&as_oq=&as_eq=&num=100&lr=&as_filetype=pdf&ft=i&as_sitesearch=uc.edu&as_qdr=all&as_rights=&as_occt=any&cr=&as_nlo=&as_nhi=&safe=off"
echo.%str%
echo.%str% >> url.txt

Any suggestions how to strip out the quotes from the file url.txt

Thank you so much!

Posted: 01 Jun 2009 11:37
by avery_larry
How about:

echo.%str:"=%>>url.txt
Should work as long as str is defined. You could do this:

if defined str echo.%str:"=%>>url.txt

Posted: 01 Jun 2009 11:47
by avery_larry
Oops. Should have tested that. Try this instead:

Code: Select all

set str="http://www.google.com/search?hl=en&as_q=canada&as_epq=&as_oq=&as_eq=&num=100&lr=&as_filetype=pdf&ft=i&as_sitesearch=uc.edu&as_qdr=all&as_rights=&as_occt=any&cr=&as_nlo=&as_nhi=&safe=off"
echo.%str%
for /f %%a in (%str%) do echo.%%~a>>url.txt

Thanks so much for that help!!!

Posted: 01 Jun 2009 14:29
by mungurk
avery_larry, Thank you so much for helping me with this one.
I just could not seem to get my head around it properly.

All the best...