- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: Perl Execute Help
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2006 07:27 AM
08-03-2006 07:27 AM
I need help: I try to get UNIX shell scripts working in Windows environment by using perl, somehow I fail.
1) on cmd prompt:
perl -i.save -p -e "s/DEVELOP/PRODUCTION/gi" c:\temp\test1.txt
it is working as desired.
2) if I make a mytest.pl file as
c:\perl\bin\perl.exe -i.save -p -s "s/DEVELOP/PRODUCTION/gi" c:\temp\test1.txt
then execute from cmd prompt as c:\perl\bin\perl mytest.pl, I get error like "panic: uf16_to_uft8: odd bytlen 155"
3) if I make a batch file test.bat as
c:\perl\bin\perl.exe -i.save -p -e "s/DEVELOP/PRODUCTION/gi" c:\temp\test1.txt
from cmd prompt issue test.bat, or use AT command for scheduling, batch is executed, but nothing happened to the file.
4) I have 10+ batches consisting of a whole job. In UNIX, shell script makes it easy by just listing each command as "sh a1" as 1st, "sh a2" as 2nd, and so on in a file. The job will be executed in order.
In windows, I would like to see how people get around to do the job. Please help as you can.
Appreciated.
Steven
Solved! Go to Solution.
- Tags:
- Perl
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2006 07:47 AM
08-03-2006 07:47 AM
Solutionperl -i.save -p -e "s/DEVELOP/PRODUCTION/gi" xx.txt
I suspect what is wrong is that your @INC is not setup correctly.
Execute perl -V and look for @INC very near the end of your output.
You can set @INC by add -I arguments to your perl execution line and this is required if you are running for example, a pre-exec for Data Protector
Your command would look something like this:
perl -I C:/Perl/lib -I C:/Perl/site/lib myscript.pl
assuming that C:\Perl\bin is also somewhere in your PATH --- and no, I did not get the slashes backwards for the -I argument --- and why aren't you asking a Windows question elsewhere??
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2006 07:50 AM
08-03-2006 07:50 AM
Re: Perl Execute Help
1) OK
2) You have to put perl code into the .pl file, not the command itself:
c:\ type mytest.pl
s/DEVELOP/PRODUCTION/gi
c:\ \perl\bin\perl.exe -i.save -p \temp\mytest.pl \temp\test1.txt
3) The .bat should work, if all required parameters and options are founnd in it.
consider a
C:
or equiv. to get a well defined '\'
At jobs need a 'cmd /c' wrapped around a .bat mostly.
4) Write your script completly in perl.
mfG Peter
... who normally tries to avoid to deal with such PC stuff.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2006 07:51 AM
08-03-2006 07:51 AM
Re: Perl Execute Help
Feel free to give no points if this is totally useless info for you.
Windows is hateful. In all respects.
You might try binmode or -C3 option
binmode STDIN, ":utf8";
binmode STDOUT, ":utf8";
Enjoy, Have FUN! H.Merijn
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2006 08:14 AM
08-03-2006 08:14 AM
Re: Perl Execute Help
You are exactly right. "perl -V" returns with:
Perl lib version
I have Oracle 10g installed before installing perl 5.8.8.
Do you think uninstalling perl 5.8.8 then installing 5.8.3 will work? Or just use Oracle perl binary?
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2006 08:20 AM
08-03-2006 08:20 AM
Re: Perl Execute Help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2006 08:28 AM
08-03-2006 08:28 AM
Re: Perl Execute Help
Sorry to bother you, I wasn't pay realized that it is hpux forum.
Thanks for any help.