outputing thewordsfrom a file using findstr

  • Thread starter Thread starter Jean Pierre Daviau
  • Start date Start date
J

Jean Pierre Daviau

Hi gang,

I am trying to output the name of the name of the images in a file with
findstr /i ".jpg\>" snow.html:

<p><img src="layerlist.jpg" width="296" height="299" alt="-" /></p>
<img src="onebyone.jpg" width="102" height="299" alt="-" />


Thanks for your attention and good recovery from Christmass ;-),



--
Jean Pierre Daviau

- - - -
Art: http://www.jeanpierredaviau.com
Maison à vendre:
http://www.jeanpierredaviau.com/maison/
 
Hi gang,

I am trying to output the name of the name of the images in a file with
findstr /i ".jpg\>" snow.html:

<p><img src="layerlist.jpg" width="296" height="299" alt="-" /></p>
<img src="onebyone.jpg" width="102" height="299" alt="-" />


Thanks for your attention and good recovery from Christmass ;-),

If each jpg is on one line and img src is the first item (containing the
first = sign actually):


@echo off
for /f "tokens=2 delims==" %%a in (
'findstr /i /r "\.jpg. " "snow.html"'
) do for /f %%b in ("%%a") do echo %%b
pause


It's a bit hit and miss with html because it's conceivable that the .jpg
name will span two lines and this will miss that kind of thing as well as
many other situations. It just deals with your sample code.
 
foxidrive said:
If each jpg is on one line and img src is the first item (containing the
first = sign actually):


@echo off
for /f "tokens=2 delims==" %%a in (
'findstr /i /r "\.jpg. " "snow.html"'
) do for /f %%b in ("%%a") do echo %%b
pause


It's a bit hit and miss with html because it's conceivable that the .jpg
name will span two lines and this will miss that kind of thing as well as
many other situations. It just deals with your sample code.

Thanks
 
Back
Top