How can I grap c all text in every single lin

July 15, 2009 at 15:36:17
Specs: Windows XP
I have couple of files. One of them contains more than 10,000 directory path and file name of .c and another one contains equvalent .o.

I have to write a command line script file.
It should open the c_list.txt and grep the first c file "CheckWrite.c" and open the o_list.txt and find whether equivalent "CheckWrite.o" is there.
If the CheckWrite.o is not there then it should echo in the screen or write in a separate file.

How do grep the all the .c files one by one from the c_file list and compare with o_file.list?




See More: How can I grap c all text in every single lin

Report •

July 15, 2009 at 18:07:31
see here for an example using vbscript

GNU win32 packages | Gawk

Report •

July 16, 2009 at 09:05:00
Thank you very much ghostdog

rem ---------- compare .c file list with .o list ---------------

for /f "tokens=* delims=" %%a in (c_list.txt) do (
set pathname1=%%~dpa
set filename1=%%~na
set notfound=1
set flag=1

for /f "tokens=* delims= " %%b in (o_list.txt) do (
set pathname2=%%~dpb
set filename2=%%~nb

if !filename1! equ !filename2! (
set notfound=0


if !flag! equ !notfound! (
echo !pathname1!!filename1!.c is not found >> result.txt


This is my program. Now If I find the c file name in o_file list then I want to exit from for look how do I do that?

Report •

Related Solutions

Ask Question