Batch remove line from text file if word match from other text file -
i have 2 text files.
1 contains filename path before it.
, other filename.
want remove lines pathnames if filename match.
can want files doesn't match in new created text file 3
so list1.txt has:
c:\program files\folder1\enter c:\program files\folder1\numbers.txt c:\program files\folder1\files.jpg c:\program files\folder1\movies.jpg
and list2.txt has:
enter numbers.txt files.jpg
outcome has in list3.txt
c:\program files\folder1\movies.jpg
you shoud read on findstr (findstr /?
command line). also, read what undocumented features , limitations of windows findstr command?.
here simple batch script job.
@echo off >"list2.txt.mod" (for /f "usebackq delims=|" %%f in ("list2.txt") echo \%%f) findstr /liveg:"list2.txt.mod" "list1.txt" >"list3.txt" del "list2.txt.mod"
if change list2.txt like:
\enter \numbers.txt \files.jpg
then need following command line (no batch needed)
findstr /liveg:"list2.txt" "list1.txt" >"list3.txt"
Comments
Post a Comment