HavenRock.com: home
 
Asia ... Documentation ... Downloads ... DSSSL ... EFL/ESL ... HTML tools ... Japanese text ... Linux ... Photography ... Python ... SGML ... Tcl/Tk ... TeX ... Tips ... Typography ... Word processing

Text editor techniques

The foregoing solutions are probably most useful if you have a lot of files to convert. But if conversion is just an occasional need, you might get along fine with the tools you already have.

Rick Dearman recommends using the vi editor:

It is easier to open the file in vi and do the following command

        :%s/\\n\\r/\\n/g
	      

to convert to unix or use

        :%s/\\n/\\n\\r/g
	      

to convert to dos.

I like vi, in addition I would suggest that most people learning UNIX learn vi. since it is on every version of UNIX, and Emacs is not going to be.

I'm an Emacs fan myself, but Rick's point is well taken.

I'd like to note that Rick's regular expression didn't work for me. I use vim, the "vi improved" editor; perhaps he uses a more traditional vi and the syntax is a little different. I'm sure some variation of the above will work regardless of what flavor of vi you have. It might be best to check the vi online help for regular expressions.

Finally, for those who run DOS/Windows, Chris Bonanno (AKA GooMBa) offers the following:

I dunno if this will help, but since I dual boot both Linux and Win '98, I do a lot of text writing in Linux, and reading while in Dos/Win '98. Initially, I was having trouble reading the Linux txt files because of the LR/CF characters in the documents. My simple solution? Type "edit 'filename.txt'" in Dos, and save the file. Then the line returns & carridge returns are removed from the text files. Everything was ok after then, but I still don't know about the Mac format... :/

There you have it. There should be something here to meet almost anyone's needs. But if you think something's missing, feel free to contribute your favorite text conversion method.































	      

regular expression, regexp, regex
A pattern of characters used for searching or replacing text. Regexps can be used to efficiently edit complex patterns in large files.

For those who want to learn about regular expressions: I've been searching for a good tutorial on the web. I've found a number of tutorials that apply to specific editors or programming languages, but so far no general introductions to regexps. I'm considering writing one myself and posting it here.

Matt Gushee

Last modified: Sun Oct 17 11:31:55 EDT 1999