Re: Converting linefeeds in text files


Subject: Re: Converting linefeeds in text files
bryan@ak.net
Date: Mon Dec 22 2003 - 04:38:11 AKST


On Mon, Dec 22, 2003 at 01:48:41AM -0900, Brandon Barnes <jbbarnes@gci.net> wrote:
>
> I sometimes find text files on my Linux system that must have been ftpd
> from a Windows machine in binary mode, because they have Carriage
> Return/Line Feed (hex 0D 0A) instead of plain linefeeds (hex 0A). Is
> there some simple command I can run that will either strip carriage
> return characters from a file or add them if I want to go the other

Slackware comes with the fromdos and todos utilities for that purpose.
If you run another distro, you might find them on freshmeat or elsewhere.

It can also be done with a simple tr (sed?) command, if you remember the
syntax (which I don't).

> direction? Also, I seem to recall reading that Windows uses hex
> character 1A for an end-of-file marker, and Linux uses 04. So that would
> probably need to be taken into account, too.

Um, neither dos nor unix uses an end-of-file marker. When you're
inputting a text file from the command line ("copy con filename.txt"
in dos, or "cat >filename.txt" in unix), dos uses ^Z to end the
operation, and unix uses ^D, but neither is included in the file.

--
Bryan Medsker
bryan@ak.net

--------- To unsubscribe, send email to <aklug-request@aklug.org> with 'unsubscribe' in the message body.



This archive was generated by hypermail 2a23 : Mon Dec 22 2003 - 04:37:32 AKST