windows - How to open file indicated in a .txt file and remove user defined start of the the line pattern -
for illustration have names.txt. when open file see 3 columns
name1.txt name2.txt name3.txt name4.txt name5.txt name6.txt *column2 can found in "c:\name\male" directory column3 can found in "c:\name\female" directory*
now, how can implememt in batch script?
first, when run batch script, column 2 , 3 files 1 editted user. want user have alternative line want remove filenames indicated in column2 , column3.
for example:
enter pattern want remove: peter
now, files in column2 , column3 of files.txt containing "peter" @ start of line removed.
here's code below.
for /f "tokens=2,3" %%a in (c:\name\files.txt) ( set /p line=enter pattern want remove: set line=!line:,=" /c:"! findstr /v /i /c:"!line!" "c:\name\male\%%b" > "c:\comp\male\%%b" findstr /v /i /c:"!line!" "c:\name\female\%%c" > "c:\comp\female\%%c" )
i cant working. everytime run batch file code creates new files indicated in files.txt 0 bytes size.
windows batch-file cmd
No comments:
Post a Comment