This is the mail archive of the
cygwin@sourceware.cygnus.com
mailing list for the Cygwin project.
Re: \n->\r\n?
- To: gnu-win32 at cygnus dot com
- Subject: Re: \n->\r\n?
- From: Martin Svenningsson <emmess at bml dot se dot org>
- Date: Fri, 06 Feb 1998 23:26:20 -0100
- IRC: EmmEss on irc.dal.net and irc.valhall.net
- Key: RSA 2048 0x685C30F5, B7E8 8405 CFD0 66D2 DB83 330D C973 95CA
- Key: RSA 512 0xB553008D, D8C2 1877 71E0 921B 0725 5603 F40D 6244
- Key: DH 3072 0xE714ED2A, 862B 11E2 D481 D2D9 79AB 9B86 B97C D02F E714 ED2A
- Organisation: BML
- Spam-To: root@localhost
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Martin Svenningsson writes: (17:14 1998-02-06 -0100)
> Can I do something simular to transalte from lf to crlf?
OK, first of all; sorry for replying to my own mail..
I needed to translate a couple of files quick so I wrote this little
perlscript that I wish to share with everybody. (but I still don't
know if there's a easier way to do it)
PS Im not a perl programmer, so don't laugh at me ;P DS
- ---- lf3crlf.pl start ----
#!/bin/perl
##
# lf2crlf.pl - translates unix lf files do dos crlf.
# By: EmmEss <emmess@bml.se.org> Feb 1998.
# Do whatcha want, NO WARRANTY :).
####
if ((!@ARGV) or ($ARGV[0] eq '-h') or ($ARGV[0] eq '--help')) {
print "\nlf2crlf.pl by EmmEss - translates \\n to \\r\\n\n";
print "Usage: lf2crlf lf_file > crlf_file\n";
exit(0);
}
if (open(INFILE, $ARGV[0])) {
@lffile = <INFILE>;
close(INFILE);
} else {
print "Can't open $ARGV[0]\n";
exit(-1);
}
foreach $i (0..$#lffile) {
$lffile[$i] =~ s/\n/\r\n/g;
print $lffile[$i];
}
- ---- lf3crlf.pl end ----
-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 5.0i for non-commercial use
Charset: noconv
iQA/AwUBNNup2Ll80C/nFO0qEQLk9ACfXUFUrDNnOssTr8YJUwx3uhnOxBwAoPpD
dlqNYd856oEXcwcGhZGU9G6M
=l1cO
-----END PGP SIGNATURE-----
__________________________________________________
Martin 'EmmEss' Svenningsson - Helsingborg, SWEDEN
http://www.tripnet.se/~emmess/ - emmess@bml.se.org
See my mail headers for info about my PGP pub keys
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".