APM: Perl on Windows 2000
Wayne Walker
wwalker at bybent.com
Wed Sep 11 11:58:06 CDT 2002
The file is probably in unicode. So every character is made up of two
bytes. zip the file, then get it on a linux box and run:
od -cx filename | less
That will let you see what the "blanks" are. Then you can do something
like this on thw W2K side:
Insert Redhat ...er..no , like this
while (<BACKUPFILE>) {
chomp;
s/\000//g; # Remove all ASCII nuls
# (I think \000 represents a single character in perl in octal, I may
# have this wrong don't use it very often and have to head to to
# office, running a little behind on my 9:00 start time...)
print;
#print if /^ Backup Type:/ ;
#print if /B a/ ;
}
On Wed, Sep 11, 2002 at 11:23:03AM -0500, Tom.Bakken wrote:
> I'm off to a creaky start running perl scripts on a windows 2000
> server. I'm used to LINUX, so maybe somebody that's been down this road
> can share some of their hard earned experience with me.
>
> I've written a very simple perl script:
> #!perl -w
> use strict;
> use CGI;
> unless (open BACKUPFILE, "f:/serverbackup/2002.09.10.11.00p.txt") {
> die "Cannot read backup file: $!";
> }
> while (<BACKUPFILE>) {
> chomp;
> print;
> #print if /^ Backup Type:/ ;
> #print if /B a/ ;
> }
>
> Which works great as far as opening and reading the file.
> Unfortunately, there's some white space between each of the characters.
> The file looks normal in word pad and notepad and type the file from the
> command prompt, but when I use edit from the command prompt and print
> the file from the perl script, there is white space inserted between
> each of the characters.
>
> I've checked the perldoc FAQ on DOS but can't see where I err.
>
> Any help for a PERL/Win32 novice?
>
> --
> Tom Bakken
> Information Resource Manager
> USDA, Rural Development
> 101 South Main, Suite 102
> Temple, TX 76501
>
> Phone: 254-742-9726 Fax: 254-742-9709
> Email: tom.bakken at tx.usda.gov
> _______________________________________________
> Austin mailing list
> Austin at mail.pm.org
> http://mail.pm.org/mailman/listinfo/austin
--
Wayne Walker
More information about the Austin
mailing list