1.

Solve : Pb with Findstr and applying filters on extention file?

Answer»

hello everybody,

i ll try to explain my problem in english, but i m french...so....
well,

i m trying to make a little batch to check extention file and once i got this information i have to check in each of files with the specific extention if there a string called " debut" or "FIN"
but i don't know how to reach my aim.

i ALREADY got this part:

Code: [Select]
if "%1%"=="" echo you have to WRITE wich extention you have to check.Like test.bat 117 && goto er_stx

if not "%1%"=="" goto vf_file

:vf_file
del out.txt
echo extention file to check is %1%
dir /B *.%1% > out.txt
echo Following Process will be checked:
FOR /F %%i in (out.txt) do @echo %%i

REM this following command doesn't WORKS but i don't know how to setup the findstr options.

REM FOR /F %%i in (out.txt) do findstr /f out.txt /c:"Debut" >> procs_ok.csv REM or .xls

goto fin

:fin
echo Batch file is ending.
pause
exit

:er_stx
echo Batch is ending due to a syntax error
exit


and once this thing is done i have to complete an .xls file with the repport file " procs_ok.csv

i ve tried to be as clear as possible,
sorry if my english is not so good than i think !!!!

so if anyone have a idea, i m listening !!!

thanx,

regards.
you can just use findstr like this
Code: [Select]c:\> findstr "yoursearchstring" *.txt
c:\> findstr "yourstring" *.dat
hi,
i've try what you said but it still doesn't work i i don't know why...
i've also try
this
Code: [Select]findstr /F:out.txt /I ^".*" >> prcs_ok.txt
and it print the files of the file out.txt containing characters in the cmd prompt but it's not sent in the procs_ok.txt,

i have another idea to apply filter,
i've seen that some process repport files had sometimes twice the same word in it,so i would like to apply a filter on the first word of the last line.
but apparently i'm not friendly with the findstr cmd....
so if anyone have an idea....i'm still open !!

thanx,

Regards.



Discussion

No Comment Found