Question : How do I delete some lines in a text file?

Need help with writing a bat file or a simple VBS script to delete certain lines in a text file. Lines of text documents are my type:

C: \ xxx \ xxx \ Anything               - delete
C: \ xxx \ xxx \ anythingt.pdf       - keep
C: \ xxx \ xxx \ anything.jpg          - keep
C: \ xxx \ xxx \ Anything               - delete
...
Necessarily need to delete all the rows that do not have to end their pre-selected word endings such as jpg, jpeg, raw, pdf, bmp, doc, etc. Because it can increase the number of endings, so I simply add the script. Warning: rows, ending with the end containing said pathnames are always different.
Thanks to all for your help!

Answer : How do I delete some lines in a text file?

Why not do it with the FINDSTR command, no script needed?

If you want to look for specific extensions, then do:

findstr /i /c:".doc" /c:".pdf" /c:".jpg" oldfile.txt >newfile.txt

If you just want all lines that have a period then this will work:

findstr /i /c:"." oldfile.txt >newfile.txt

~bp
Random Solutions  
 
programming4us programming4us