TCLUG Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [TCLUG:10735] FromDOS?



Excuse me please! My brain does not seem to be connected this evening.
Here are scripts that seem to work. 

------------------------
#!/usr/bin/perl -w
# unix2dos
while (<>) {
        s/\n/\r\n/g;
	print;
}
------------------------
#!/usr/bin/perl -w
# dos2unix
while (<>) {
        s/\r//g;
	print;
}
------------------------


Troy Johnson wrote:
> 
> I think it is something easy like:
> 
> ------------------------
> #!/usr/local/perl -w
> # unix2dos
> while (<>) {
>         s/\n/\n\r/g;
> }
> ------------------------
> #!/usr/local/perl -w
> # dos2unix
> while (<>) {
>         s/\r//g;
> }
> ------------------------
> 
> but it could probably be found in a perl book or doc somewhere.
> 
> Good luck,
> 
> Troy
> 
> Callum Lerwick wrote:
> >
> > Mike Hicks wrote:
> > >
> > > I'm looking for a script (in Perl, probably) to convert DOS text (CRLF)
> > > into UNIX text (LF?)..
> > >
> > > anyone have one?
> >
> > Hmmm. Back in my slackware days there was dos2unix or something like
> > that. RedHat doesn't seem to have it... :P
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tclug-list-unsubscribe@mn-linux.org
> For additional commands, e-mail: tclug-list-help@mn-linux.org