how to match '\r\n' in dos environment
From: Liang (leo2002chen_at_hotmail.com)
Date: 08/27/04
- Next message: Gunnar Hjalmarsson: "Re: how to match '\r\n' in dos environment"
- Previous message: Chris Cole: "Re: Need help: perl script to FTP"
- Next in thread: Gunnar Hjalmarsson: "Re: how to match '\r\n' in dos environment"
- Reply: Gunnar Hjalmarsson: "Re: how to match '\r\n' in dos environment"
- Reply: Jürgen Exner: "Re: how to match '\r\n' in dos environment"
- Reply: Joe Smith: "Re: how to match '\r\n' in dos environment"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 27 Aug 2004 18:54:54 +0800
hi,
I want to convert a file from dos formate to unix format. This is very easy
in unix. But in dos environment, the script can't work.
The perl version I used is:5.001.
Anyone knows the clue? thanks in advance,
open(INPUT, "<$opt_f");
rename( $opt_f, "$opt_f.bak") || die "Unable to rename $opt_f\n$!\n";
open(OUTPUT, ">$opt_f");
while(<INPUT>) {
if ( s/\r\n/\n/ ) {
$linesFixed++;
}
print OUTPUT;
}
- Next message: Gunnar Hjalmarsson: "Re: how to match '\r\n' in dos environment"
- Previous message: Chris Cole: "Re: Need help: perl script to FTP"
- Next in thread: Gunnar Hjalmarsson: "Re: how to match '\r\n' in dos environment"
- Reply: Gunnar Hjalmarsson: "Re: how to match '\r\n' in dos environment"
- Reply: Jürgen Exner: "Re: how to match '\r\n' in dos environment"
- Reply: Joe Smith: "Re: how to match '\r\n' in dos environment"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|