[geeks] Nerdy scripting help...

Jonathan J. M. Katz jon at jonworld.com
Wed Oct 13 16:15:58 CDT 2010


Geeks,

I can do what I want to do in Unix no problem. Doing it in dos/windows is
the issue.

For loop that looks for files fitting a certain file name
Checking contents of that file.
Rename file based on contents.

In Unix I do...

#!/bin/sh
for X in *.xml; do
     if [ `grep "\</Audit\>" ${X}` ]; then mv ${X} ${X}.done; fi
done

I've been playing with the for loops in DOS and got them to work, as well as
the find command, but the find command does not act like grep and doesn't
give me output I can use. Anyone else solve this before?

Thanks!

-Jon



More information about the geeks mailing list