Subject: Re: \n->\r\n?
From: [email-masked] (Martin Svenningsson)

6 Feb 1998 19:26:22 -0800
Message-ID: <[email-masked]>
References: <[email-masked]>
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
To: [email-masked]

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 <[email-masked]> 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 ----

__________________________________________________
Martin 'EmmEss' Svenningsson - Helsingborg, SWEDEN
http://www.tripnet.se/~emmess/ - [email-masked]
See my mail headers for info about my PGP pub keys 
-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".