I generally agree with the sentiment expressed by others - batch is lousy at processing text. Using another language or tool is a good idea for your task.
But it can be done with batch :-)
Simply inserting a linefeed before each html://
is not so hard
@echo off
setlocal disableDelayedExpansion
:: The first FOR loop loads a quoted linefeed into %%L
:: The blank line within the IN() clause is critical. Do not remove.
for %%L in (^"^
^") do (
for /d %%A in ("C:\Documents and Settings\*") do (
for /f "eol=: delims=" %%B in (
'findstr /S "http://" "%%A\Application Data\Sun\Java\Deployment\cache\6.0\*"'
) do (
set "line=%%B"
setlocal enableDelayedExpansion
echo(!line:http://=%%~Lhttp://!
endlocal
)
)
) >c:\temp\javaurls.txt
But preserving only resulting lines that begin with http://
and also preserving the name of each file before the address becomes a real pain.
@echo off
setlocal disableDelayedExpansion
:: The first FOR loop loads a quoted linefeed into %%L
:: The blank line within the IN() clause is critical. Do not remove.
for %%L in (^"^
^") do (
for /d %%A in ("C:\Documents and Settings\*") do (
for /f "tokens=1* delims=:" %%B in (
'findstr /S "http://" "%%A\Application Data\Sun\Java\Deployment\cache\6.0\*"'
) do (
set "line=%%C"
setlocal enableDelayedExpansion
set "line=!line:http://=%%~Lhttp://!"
for /f "delims=" %%D in (
'"cmd /v:on /c echo(^!line^!|findstr http://"'
) do (
if "!!" equ "" endlocal
echo %%B: %%D
)
)
)
) >c:\temp\javaurls.txt
exit /b