[geeks] Nerdy scripting help...

nate at portents.com nate at portents.com
Wed Oct 13 16:52:39 CDT 2010


On Wed, 13 Oct 2010 17:15:58 -0400, "Jonathan J. M. Katz"
<jon at jonworld.com> wrote:
> 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?

Haven't had to solve this particular problem before in Windows, but if I
had to, I'd try to use PowerShell (PowerShell 2.0 is integrated with
Windows 7 and Windows Server 2008 R2 and is released for Windows XP with
Service Pack 3, Windows Server 2003 with Service Pack 2, Windows Vista with
Service Pack 1, and Windows Server 2008).  More on PowerShell here:

http://technet.microsoft.com/en-us/scriptcenter/powershell.aspx

- Nate



More information about the geeks mailing list