outputing thewordsfrom a file using findstr

  • Thread starter Jean Pierre Daviau
  • 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/
 
F

foxidrive

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.
 
J

Jean Pierre Daviau

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

findstr 9

Top