Take the 2-minute tour ×

I have a great perl script I use to untar/unzip a tarball of a file, then correlate a dozen+ files for smart troubleshooting of a NAS system. Now people want to see a version for windows =/

I am Linux savvy, rookie to Perl and not at all comfortable with scripting for windows.

The snags I see are: (1) install location of perl (2) I rely on output from grep and find (3) potential snags between versions - XP,Vista?,7,2k3,2k8.

No luck so far w/Cygwin, or Windows version of find. I have ActivePerl installed on Windows 7.


share|improve this question

5 Answers 5

up vote 2 down vote accepted

Grep (or grep-like) functions can be reached using

You can use find, per RedGrittyBrick's note above (err, below? He keeps moving).

I've recently ported a Windows Vista Perl script to XP, and it is no big deal. The only hitches I've run into are use of the 'exec' or the 'system' calls within Perl in order to trigger operation of MS Office programs. Unless you are doing something like this, you will probably see no difficulty in moving back and forth among the Windows OSes.

Incidentally, I wasn't initially aware, in my use of ActiveState Perl, of the PPM function that lets you grab open-sourced libraries for specialty functions. Be sure and try that out to avoid re-invention of the wheel.

share|improve this answer
Thanks - let me take a look and see how it goes. –  mjb Mar 28 '11 at 19:56
I believe the stackexchange engine used by SuperUser.com randomises the order of unaccepted equal-scored answers, so hitting refresh will often change the order of answers. It's sometimes a bit surprising and/or irritating but I can see it might be said to even out any unfair bias when people are reading and upvoting answers. –  RedGrittyBrick Apr 1 '11 at 14:49

Have you tried msys? I'm a git user so I nearly consider everything from msysgit to be a part of my OS now.

msys - http://www.mingw.org/wiki/msys

msysgit - http://code.google.com/p/msysgit/

share|improve this answer

Cygwin has find and grep.

If find gives you some weird error message, it means you're running a different find command.

Try editing your PATH to put Cygwin's /bin and /usr/bin at the start, or run find using an absolute pathname, e.g. /usr/bin/find instead of find.

But yes, others are right, you could certainly replace find with File::Find and the grep command with Perl's grep function or regular expression matching operators
(e.g. $line =~ /pattern/).

ActivePerl is probably fine, but Strawberry Perl seems to be becoming the most popular option on Windows, so that's another option if for some reason ActivePerl doesn't work out.

share|improve this answer
Definitely right - there is a find... but now the trick would be to replace the `find $PWD -name "foo"` in perl w/references to cygwin... any idea? –  mjb Mar 29 '11 at 15:25

Cygwin is usually the easiest solution to this type of issue. What problems have you had with it?

share|improve this answer
Thanks - Cygwin has no find built in. That limits its usefulness in this case. I either want the easiest way to port or the easiest way to avoid porting. –  mjb Mar 28 '11 at 19:54
@mjb: Cygwin has find. If find doesn't work, try /usr/bin/find. –  Mikel Mar 28 '11 at 20:10
@mjb: like Mikel said, Cygwin does indeed have find. Run the cygwin installer again and make sure the findutils package is selected (you can type in findutils in the search box to easily locate it) –  Russell Davis Mar 30 '11 at 6:53
  1. Install location of perl - shouldn't cause any problems.
  2. Replace use of grep/find with Perl modules. E.g. File::Find.
  3. I've not had any Windows-version issues. What did you have in mind?
share|improve this answer

Your Answer


