Perl

Moderators: Jonathan
Number of threads: 1259
Number of posts: 3644

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
From Perl to a wndows based script? Posted by sport404 on 17 Feb 2006 at 2:17 PM
Hey guys, I have two scripts that are written in perl and I wan't to know if there is a way to get them put into a dos batch file instead of having to run on a linux box. Here is the first one, I noticed that it uses awk which I believe there might be a windos version of that out these days. My main concern is that the second part that gets called "it.revs" won't be able to be put into a batch file because of the syntax it uses. Thanks for any input or options. Also is it possible to just run a perl script on a windows box with a perl compiler or interperter or something like that?

#!/bin/sh
cd /home/revs
smbmount //bnhcfs/revs /mnt/revs -o username=****
rm /mnt/revs/LIST*
awk -f it.revs /mnt/revs/REV_CHK.txt
smbumount /mnt/revs


now here is the it.revs file that awk calls

{
if ( $1 ~ /^[0-9]/ ) {
FIRST = substr($1,1,3)
SECOND = substr($1,5,2)
THIRD = substr($1,8,4)
MEMBER = FIRST SECOND THIRD
MONTH = substr($2,1,2)
DAY = substr($2,4,2)
YEAR = 20 substr($2,7,2)
DATE = YEAR MONTH DAY
printf("%381s%9s%32s%8s%41s\r\n","ISA*03*USERID    *01*PASSW0RD  *ZZ*1309927        *ZZ*PC-WEB         *030521*1614*U*00401*000000905*1*P*:~GS*HS*USERID*MASS XIX DMA*20030521*1614*1*X*004010X092A1~ST*270*0001~BHT*0022*13*REPW*20030521*1614~HL*1**20*1~NM1*PR*2*MASSACHUSETTS MEDICAID*****PI*MASS XIX DMA~HL*2*1*21*1~NM1*1P*2******SV*1309927~REF*JD*USERID~REF*EL*PCX022200022P~HL*3*2*22*0~NM1*IL*1*XXXXXXXXXX*X****MI*", MEMBER, "~REF*GH*000000000001~DTP*307*D8*", DATE, "~EQ*30~SE*14*0001~GE*1*1~IEA*1*000000905~") > "/mnt/revs/LIST" MONTH DAY ".txt"
}
}


THANKS!

Report
Re: From Perl to a wndows based script? Posted by KevinADC on 18 Feb 2006 at 1:05 PM
You can run perl on windows using activesateperl:

www.activestate.com

but you can't run linux/unix shell scripts on windows. Maybe there is linux emulation software you can install on windows to run stuff like awk, but I don't know of it myself. But perl can handle all if not most of the awk stuff using perl functions.
Report
Re: From Perl to a wndows based script? Posted by sport404 on 18 Feb 2006 at 6:10 PM
I made it happen real easily. I just installed gawk the windows version of awk and was able to write a quick .bat file to run the awk program.

thanks!


: You can run perl on windows using activesateperl:
:
: www.activestate.com
:
: but you can't run linux/unix shell scripts on windows. Maybe there is linux emulation software you can install on windows to run stuff like awk, but I don't know of it myself. But perl can handle all if not most of the awk stuff using perl functions.
:

Report
Re: From Perl to a wndows based script? Posted by KevinADC on 18 Feb 2006 at 9:52 PM
This message was edited by KevinADC at 2006-2-18 21:52:49

: I made it happen real easily. I just installed gawk the windows version of awk and was able to write a quick .bat file to run the awk program.
:
: thanks!


gawk huh? I'll have to remember that, thanks for posting back :)





 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.