Re: replacing ^M with emacs
On 2006-10-30 10:03, Giorgos Keramidas <[EMAIL PROTECTED]> wrote: > On 2006-10-28 04:18, Tsampros Leonidas <[EMAIL PROTECTED]> wrote: > > I think there is something similar in emacs by using the > > set-buffer-file-coding-system (binded at C-x RET f in default > > configurations). > > > > So to "cure" and succesfully "convert" DOS files into unix format, i > > use C-x RET f unix RET. > > I'm not sure `set-buffer-file-coding-system' will have any effect on an > already opened file though. I just tried this with a file which was > created outside Emacs, and contained: > > $ cat -vte foo > fooo^M$ > $ > > Opening this file with `C-x C-f foo RET' and setting the buffer file > coding system with `C-x RET f unix RET', marks the buffer as modified, > but saving the file does not modify the contents of the file to use UNIX > newlines only. > > If you really want to use Emacs for the conversion, you have to > *explicitly* replace ^M characters, either with `M-x replace-string RET > C-q C-m RET RET' or some either way. Oops... Apparently, I have `inhibit-eol-conversion' modified locally. This is what makes Emacs avoid EOL conversion when `set-buffer-file-coding-system' is called. Sorry for the confusion. ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: replacing ^M with emacs
On 2006-10-27 16:30, Noah <[EMAIL PROTECTED]> wrote: > > Thanks Peter, > > where is the logic here? What is control-q for and what is control-j > for? I am trying to figure out how I could have figured that out. > > also is there a better page than the one I am using below to figure all > these keystrokes out? > > http://www.math.uh.edu/~bgb/emacs_keys.html `C-q' is an Emacs-specific prefix for `quoting' the next character when you are inserting text. This way, you can enter special characters, like C-a, C-b, C-c, ... C-z while you are typing text. Just hitting the respective control-key combination may be bound to an Emacs command. The relevant text from the Emacs manual describes this much better than me: Only printing characters and insert themselves in Emacs. Other characters act as editing commands and do not insert themselves. These include control characters, and characters with codes above 200 octal. If you need to insert one of these characters in the buffer, you must "quote" it by typing the character `Control-q' (`quoted-insert') first. (This character's name is normally written `C-q' for short.) There are two ways to use `C-q': * `C-q' followed by any non-graphic character (even `C-g') inserts that character. * `C-q' followed by a sequence of octal digits inserts the character with the specified octal character code. You can use any number of octal digits; any non-digit terminates the sequence. If the terminating character is , it serves only to terminate the sequence. Any other non-digit terminates the sequence and then acts as normal input--thus, `C-q 1 0 1 B' inserts `AB'. The use of octal sequences is disabled in ordinary non-binary Overwrite mode, to give you a convenient way to insert a digit instead of overwriting with it. This is from section 8.1 (Inserting Text), of the Emacs 22 manual. I hope this helps :-) ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: replacing ^M with emacs
On 2006-10-28 04:18, Tsampros Leonidas <[EMAIL PROTECTED]> wrote: > I think there is something similar in emacs by using the > set-buffer-file-coding-system (binded at C-x RET f in default > configurations). > > So to "cure" and succesfully "convert" DOS files into unix format, i > use C-x RET f unix RET. I'm not sure `set-buffer-file-coding-system' will have any effect on an already opened file though. I just tried this with a file which was created outside Emacs, and contained: $ cat -vte foo fooo^M$ $ Opening this file with `C-x C-f foo RET' and setting the buffer file coding system with `C-x RET f unix RET', marks the buffer as modified, but saving the file does not modify the contents of the file to use UNIX newlines only. If you really want to use Emacs for the conversion, you have to *explicitly* replace ^M characters, either with `M-x replace-string RET C-q C-m RET RET' or some either way. ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: replacing ^M with emacs
On Sun, Oct 29, 2006 at 11:30:45AM +1030, Malcolm Kay wrote: > On Sat, 28 Oct 2006 12:27 pm, Noah wrote: > > well I am pressing control-J for return not control-M so I > > dont understand your rationale. > > > > There seems to be considerable confusion in this thread between > keystrokes and the codes they produce. > > Most modern keyboards report some form of scan code for each key > pressed whether or not it is one of the modifier or special > keys. At this stage there is no connection between the key or > key combination pressed and an ASCII code. The original post talked about the characters in a text file - most particularly the ^M and I responded to that and not to anything about keyboard codes. Generally, regardless of what scan codes the machine generates with keypresses, a text editor still puts certain codes in the text file, essentially according to the ASCII character set. Now a wordprocessor file or a WYSIWYG or a GUI system uses a much more extended set of character codes and representations and action codes. But, that wasn't the orginal post topic. jerry > > What an application sees in terms of codes depends on the OS and > anything else that may get in between. We mostly think of keys > and key combinations as being connected to the the codes seen by > an ordinary console application, but this can vary according to > the OS. > > With a standard setup running X applications with a graphics > interface are able to see all keys translated to some form of > symbol code (some sort of a super set of ASCII including codes > for special keys) which can be customised with xmodmap. > > Character mode programs under X through some terminal emulation > window will see codes (usually ASCII) as further translated by > that terminal emulator. I find that by default xterm reports ^M > on pressing the "enter/return" key but this can further > customised through XTerm or .Xdefaults. A basic key is generally > combined with the currently active modifier keys(shift,ctrl,alt, > etc) to produce the code reported to the application. Other keys > such as function keys might be reported as a sequence of codes. > > Utilities and applications may manage codes differently when they > recognise the source as the keyboard so for example Ctrl-J, > Ctrl-M and "enter" from the keyboard are all reported by "cat" > as ^J. > > Malcolm > > > > Jerry McAllister wrote: > > >> Thanks Peter, > > >> > > >> where is the logic here? What is control-q for and what is > > >> control-j for? I am trying to figure out how I could have > > >> figured that out. > > > > > > They are ASCII characters. For example, the ^M you wanted > > > to get rid of is CTRL-M.There are ASCII tables in > > > various places. A quick search should turn up a few. The > > > assignment of the characters are ancient and traditional and > > > somewhat weird by how things are currently used, but will > > > probably continue to stay that way. > > > > > > Line-Feed, for example - which is that character that marks > > > the end of a line in text files, means it causes the printer > > > to move the paper up one line - in old line printers and > > > teletypes. CTRL-M or ^M is a RETURN (also ENTER nowdays) > > > and that caused the print head to return to the beginning of > > > the line. By the time UNIX came along, it wasn't necessary > > > to use both characters to move the paper and print head > > > because those were virtual. So, they just used one > > > character - the line feed. But, MS-DOS and some others > > > continued to use the pair to mean a new line for some reason > > > - maybe the original association with IBM, although they > > > didn't use ASCII, but EBCDIC - another animal. > > > > > > So, look up an ASCII chart with explanations and you can > > > make an educated guess on the meanings. > > > > > > jerry > > > > > >> also is there a better page than the one I am using below > > >> to figure all these keystrokes out? > > >> > > >> http://www.math.uh.edu/~bgb/emacs_keys.html > > >> > > >> Cheers, > > >> > > >> Noah > > >> > > >> Peter A. Giessel wrote: > > >>> On 2006/10/27 15:20, Noah seems to have typed: > > this is the best answer. Hits it right on the head of > > what I want. What if I want the character to replace the > > ^M with a new line what do I enter in the replace field? > > >>> > > >>> control-q control-j > > >> > > >> ___ > > >> freebsd-questions@freebsd.org mailing list > > >> http://lists.freebsd.org/mailman/listinfo/freebsd-questions > > >> To unsubscribe, send any mail to > > >> "[EMAIL PROTECTED]" > > > > ___ > > freebsd-questions@freebsd.org mailing list > > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > > To unsubscribe, send any mail to > > "[EMAIL PROTECTED]" ___ freebsd-questions@freebsd.org mailing list http://li
Re: replacing ^M with emacs
On Fri, Oct 27, 2006 at 07:57:08PM -0700, Noah wrote: > well I am pressing control-J for return not control-M so I dont > understand your rationale. I don't understand your comment. There was no rationale. That is just what the ASCII characters are used for and a little of the history of how they got that way - though the choice of numeric code was mostly arbitrary, some of it had to do with easy processing of codes as control for printers and teletypes. If you use the characters in a non-traditional way, that is up to you, but other systems and utilities won't follow your pattern most likely. Now, in UNIX, since it doesn't end lines with a pair of ^M^J but only uses ^J, it may look like it is a RETURN, but the original designation is Line Feed. UNIX just picked that one. jerry > > > Jerry McAllister wrote: > >>Thanks Peter, > >> > >>where is the logic here? What is control-q for and what is control-j > >>for? I am trying to figure out how I could have figured that out. > >> > > > >They are ASCII characters. For example, the ^M you wanted to get > >rid of is CTRL-M.There are ASCII tables in various places. > >A quick search should turn up a few. The assignment of the > >characters are ancient and traditional and somewhat weird by > >how things are currently used, but will probably continue to stay > >that way. > > > >Line-Feed, for example - which is that character that marks the end > >of a line in text files, means it causes the printer to move the > >paper up one line - in old line printers and teletypes. CTRL-M or ^M > >is a RETURN (also ENTER nowdays) and that caused the print head to > >return to the beginning of the line. By the time UNIX came along, > >it wasn't necessary to use both characters to move the paper and print > >head because those were virtual. So, they just used one character - > >the line feed. But, MS-DOS and some others continued to use the > >pair to mean a new line for some reason - maybe the original association > >with IBM, although they didn't use ASCII, but EBCDIC - another animal. > > > >So, look up an ASCII chart with explanations and you can make an > >educated guess on the meanings. > > > >jerry > > > > > >>also is there a better page than the one I am using below to figure all > >>these keystrokes out? > >> > >>http://www.math.uh.edu/~bgb/emacs_keys.html > >> > >>Cheers, > >> > >>Noah > >> > >> > >>Peter A. Giessel wrote: > >> > >>>On 2006/10/27 15:20, Noah seems to have typed: > >>> > >>> > this is the best answer. Hits it right on the head of what I want. > What if I want the character to replace the ^M with a new line what do > I enter in the replace field? > > > >>>control-q control-j > >>> > >>> > >>___ > >>freebsd-questions@freebsd.org mailing list > >>http://lists.freebsd.org/mailman/listinfo/freebsd-questions > >>To unsubscribe, send any mail to > >>"[EMAIL PROTECTED]" > >> ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: replacing ^M with emacs
On Sat, 28 Oct 2006 12:27 pm, Noah wrote: > well I am pressing control-J for return not control-M so I > dont understand your rationale. > There seems to be considerable confusion in this thread between keystrokes and the codes they produce. Most modern keyboards report some form of scan code for each key pressed whether or not it is one of the modifier or special keys. At this stage there is no connection between the key or key combination pressed and an ASCII code. What an application sees in terms of codes depends on the OS and anything else that may get in between. We mostly think of keys and key combinations as being connected to the the codes seen by an ordinary console application, but this can vary according to the OS. With a standard setup running X applications with a graphics interface are able to see all keys translated to some form of symbol code (some sort of a super set of ASCII including codes for special keys) which can be customised with xmodmap. Character mode programs under X through some terminal emulation window will see codes (usually ASCII) as further translated by that terminal emulator. I find that by default xterm reports ^M on pressing the "enter/return" key but this can further customised through XTerm or .Xdefaults. A basic key is generally combined with the currently active modifier keys(shift,ctrl,alt, etc) to produce the code reported to the application. Other keys such as function keys might be reported as a sequence of codes. Utilities and applications may manage codes differently when they recognise the source as the keyboard so for example Ctrl-J, Ctrl-M and "enter" from the keyboard are all reported by "cat" as ^J. Malcolm > Jerry McAllister wrote: > >> Thanks Peter, > >> > >> where is the logic here? What is control-q for and what is > >> control-j for? I am trying to figure out how I could have > >> figured that out. > > > > They are ASCII characters. For example, the ^M you wanted > > to get rid of is CTRL-M.There are ASCII tables in > > various places. A quick search should turn up a few. The > > assignment of the characters are ancient and traditional and > > somewhat weird by how things are currently used, but will > > probably continue to stay that way. > > > > Line-Feed, for example - which is that character that marks > > the end of a line in text files, means it causes the printer > > to move the paper up one line - in old line printers and > > teletypes. CTRL-M or ^M is a RETURN (also ENTER nowdays) > > and that caused the print head to return to the beginning of > > the line. By the time UNIX came along, it wasn't necessary > > to use both characters to move the paper and print head > > because those were virtual. So, they just used one > > character - the line feed. But, MS-DOS and some others > > continued to use the pair to mean a new line for some reason > > - maybe the original association with IBM, although they > > didn't use ASCII, but EBCDIC - another animal. > > > > So, look up an ASCII chart with explanations and you can > > make an educated guess on the meanings. > > > > jerry > > > >> also is there a better page than the one I am using below > >> to figure all these keystrokes out? > >> > >> http://www.math.uh.edu/~bgb/emacs_keys.html > >> > >> Cheers, > >> > >> Noah > >> > >> Peter A. Giessel wrote: > >>> On 2006/10/27 15:20, Noah seems to have typed: > this is the best answer. Hits it right on the head of > what I want. What if I want the character to replace the > ^M with a new line what do I enter in the replace field? > >>> > >>> control-q control-j > >> > >> ___ > >> freebsd-questions@freebsd.org mailing list > >> http://lists.freebsd.org/mailman/listinfo/freebsd-questions > >> To unsubscribe, send any mail to > >> "[EMAIL PROTECTED]" > > ___ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to > "[EMAIL PROTECTED]" ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: replacing ^M with emacs
well I am pressing control-J for return not control-M so I dont understand your rationale. Jerry McAllister wrote: Thanks Peter, where is the logic here? What is control-q for and what is control-j for? I am trying to figure out how I could have figured that out. They are ASCII characters. For example, the ^M you wanted to get rid of is CTRL-M.There are ASCII tables in various places. A quick search should turn up a few. The assignment of the characters are ancient and traditional and somewhat weird by how things are currently used, but will probably continue to stay that way. Line-Feed, for example - which is that character that marks the end of a line in text files, means it causes the printer to move the paper up one line - in old line printers and teletypes. CTRL-M or ^M is a RETURN (also ENTER nowdays) and that caused the print head to return to the beginning of the line. By the time UNIX came along, it wasn't necessary to use both characters to move the paper and print head because those were virtual. So, they just used one character - the line feed. But, MS-DOS and some others continued to use the pair to mean a new line for some reason - maybe the original association with IBM, although they didn't use ASCII, but EBCDIC - another animal. So, look up an ASCII chart with explanations and you can make an educated guess on the meanings. jerry also is there a better page than the one I am using below to figure all these keystrokes out? http://www.math.uh.edu/~bgb/emacs_keys.html Cheers, Noah Peter A. Giessel wrote: On 2006/10/27 15:20, Noah seems to have typed: this is the best answer. Hits it right on the head of what I want. What if I want the character to replace the ^M with a new line what do I enter in the replace field? control-q control-j ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]" ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: replacing ^M with emacs
On Fri, Oct 27, 2006 at 05:30:34PM -0400, Jerry McAllister wrote: > On Fri, Oct 27, 2006 at 12:26:25PM -0700, Noah wrote: > > > Hi there, > > > > It appears that a text editor placed a bunch on ^M throughout a text > > file I am working with. I assure this is equivalent to eh keystroke > > control-M. > > This is probably "MS-DOS" type text file. MS text file lines > all end in a CR-LF character pair whereas UNIX text file lines > have only a LF (line feed) and the end of each line. > All text editors on MS systems do that and if you do a binary transfer > of a file from MS to UNIX you will get all the extra ^M characters > showing up. most versions of ftp have an ASCII mode that will > do the conversion for you as you transfer the file back and forth > between MS and UNIX. I think SCP only does binary transfers. > > I am not an Emacs user, but, > You can easily use tr(1) to remove all the ^M characters from a > file.tr -r "\r" goodfile > where badfile is the one with the ^M characters and goodfile is > the newly cleaned copy. The only anoying thing is having to > write to a second file and then get rid of the first or mv the > new one back to the old (as in: mv goodfile badfile after doing > the tr. > > jerry > I think there is something similar in emacs by using the set-buffer-file-coding-system (binded at C-x RET f in default configurations). So to "cure" and succesfully "convert" DOS files into unix format, i use C-x RET f unix RET. ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: replacing ^M with emacs
> > Thanks Peter, > > where is the logic here? What is control-q for and what is control-j > for? I am trying to figure out how I could have figured that out. They are ASCII characters. For example, the ^M you wanted to get rid of is CTRL-M.There are ASCII tables in various places. A quick search should turn up a few. The assignment of the characters are ancient and traditional and somewhat weird by how things are currently used, but will probably continue to stay that way. Line-Feed, for example - which is that character that marks the end of a line in text files, means it causes the printer to move the paper up one line - in old line printers and teletypes. CTRL-M or ^M is a RETURN (also ENTER nowdays) and that caused the print head to return to the beginning of the line. By the time UNIX came along, it wasn't necessary to use both characters to move the paper and print head because those were virtual. So, they just used one character - the line feed. But, MS-DOS and some others continued to use the pair to mean a new line for some reason - maybe the original association with IBM, although they didn't use ASCII, but EBCDIC - another animal. So, look up an ASCII chart with explanations and you can make an educated guess on the meanings. jerry > > also is there a better page than the one I am using below to figure all > these keystrokes out? > > http://www.math.uh.edu/~bgb/emacs_keys.html > > Cheers, > > Noah > > > Peter A. Giessel wrote: > >On 2006/10/27 15:20, Noah seems to have typed: > > > >>this is the best answer. Hits it right on the head of what I want. > >>What if I want the character to replace the ^M with a new line what do I > >>enter in the replace field? > >> > > > >control-q control-j > > > ___ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to "[EMAIL PROTECTED]" ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: replacing ^M with emacs
On 2006/10/27 15:30, Noah seems to have typed: > where is the logic here? Logic? I thought we were using emacs here? just kidding... (mostly) > What is control-q for As Giorgos posted earlier: > The important trick here is that you use C-q to 'quote' the C-m > character in the substitution string :) so then its just a matter of knowing the character for newline: > what is control-j for? The character for new line. Which, if you are using the Xwindows version of emacs, it gives you the shortcut in the "Minibuf" menu for new line when you start a query... ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: replacing ^M with emacs
On Fri, Oct 27, 2006 at 04:20:49PM -0700, Noah wrote: > this is the best answer. Hits it right on the head of what I want. > What if I want the character to replace the ^M with a new line what do I > enter in the replace field? The nice thing about that method is that it'll work for odd characters when you don't know what they are. For simple things like ^M you can always use ^Q^M to produce an actual ^M when doing the query-replace stuff. -- Darrin Chandler| Phoenix BSD Users Group [EMAIL PROTECTED] | http://bsd.phoenix.az.us/ http://www.stilyagin.com/ | ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: replacing ^M with emacs
Thanks Peter, where is the logic here? What is control-q for and what is control-j for? I am trying to figure out how I could have figured that out. also is there a better page than the one I am using below to figure all these keystrokes out? http://www.math.uh.edu/~bgb/emacs_keys.html Cheers, Noah Peter A. Giessel wrote: On 2006/10/27 15:20, Noah seems to have typed: this is the best answer. Hits it right on the head of what I want. What if I want the character to replace the ^M with a new line what do I enter in the replace field? control-q control-j ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: replacing ^M with emacs
On 2006/10/27 15:20, Noah seems to have typed: > this is the best answer. Hits it right on the head of what I want. > What if I want the character to replace the ^M with a new line what do I > enter in the replace field? control-q control-j ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: replacing ^M with emacs
this is the best answer. Hits it right on the head of what I want. What if I want the character to replace the ^M with a new line what do I enter in the replace field? cheers, Noah Peter A. Giessel wrote: On 2006/10/27 11:26, Noah seems to have typed: How might I get emacs to search replace Put a mark right before the character (control-space) move to right after the character and cut the character (control-w). Move to the top of the document (esc-<) and start a "query replace" (esc-%). Yank in the character that you previously cut (control-y). Hit return (or enter) type in the character that you want to replace the ^M with, hit return (or enter) again. Enter "y" or "n" for each case... ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: replacing ^M with emacs
On Fri, Oct 27, 2006 at 12:26:25PM -0700, Noah wrote: > Hi there, > > It appears that a text editor placed a bunch on ^M throughout a text > file I am working with. I assure this is equivalent to eh keystroke > control-M. This is probably "MS-DOS" type text file. MS text file lines all end in a CR-LF character pair whereas UNIX text file lines have only a LF (line feed) and the end of each line. All text editors on MS systems do that and if you do a binary transfer of a file from MS to UNIX you will get all the extra ^M characters showing up. most versions of ftp have an ASCII mode that will do the conversion for you as you transfer the file back and forth between MS and UNIX. I think SCP only does binary transfers. I am not an Emacs user, but, You can easily use tr(1) to remove all the ^M characters from a file.tr -r "\r" goodfile where badfile is the one with the ^M characters and goodfile is the newly cleaned copy. The only anoying thing is having to write to a second file and then get rid of the first or mv the new one back to the old (as in: mv goodfile badfile after doing the tr. jerry > > How might I get emacs to search replace > > also is there a mail list focused specifically on emacs usability? > please refer me to it? > > Cheers, > > Noah > > ___ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to "[EMAIL PROTECTED]" ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: replacing ^M with emacs
Peter A. Giessel writes: > On 2006/10/27 11:26, Noah seems to have typed: > > How might I get emacs to search replace > > Put a mark right before the character (control-space) move to > right after the character and cut the character (control-w). > Move to the top of the document (esc-<) and start a "query > replace" (esc-%). Yank in the character that you previously cut > (control-y). Hit return (or enter) type in the character that > you want to replace the ^M with, hit return (or enter) again. > Enter "y" or "n" for each case... Or if you're feeling lucky, type '!' and it will do them all Robert Huff ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: replacing ^M with emacs
There is a program in ports called unix2dos. With it comes the command dos2unix that automatically goes through the specified file and removes all of the ^M --Mike Ginsburg Derek Ragona wrote: Those ^M's are the MS-DOS EOL character. You can use sed, or tr to remove them via a commandline pipe. -Derek At 02:26 PM 10/27/2006, Noah wrote: Hi there, It appears that a text editor placed a bunch on ^M throughout a text file I am working with. I assure this is equivalent to eh keystroke control-M. How might I get emacs to search replace also is there a mail list focused specifically on emacs usability? please refer me to it? Cheers, Noah ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]" -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. MailScanner thanks transtec Computers for their support. ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: replacing ^M with emacs
Those ^M's are the MS-DOS EOL character. You can use sed, or tr to remove them via a commandline pipe. -Derek At 02:26 PM 10/27/2006, Noah wrote: Hi there, It appears that a text editor placed a bunch on ^M throughout a text file I am working with. I assure this is equivalent to eh keystroke control-M. How might I get emacs to search replace also is there a mail list focused specifically on emacs usability? please refer me to it? Cheers, Noah ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]" -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. MailScanner thanks transtec Computers for their support. -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. MailScanner thanks transtec Computers for their support. ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: replacing ^M with emacs
On 2006-10-27 12:26, Noah <[EMAIL PROTECTED]> wrote: > Hi there, > > It appears that a text editor placed a bunch on ^M throughout a text > file I am working with. I assure this is equivalent to eh keystroke > control-M. Open the file in Emacs with: M-x find-file-literally RET filename RET and then replace all ^M occurences with the empty string, with: M-x replace-string RET C-q C-m RET RET The important trick here is that you use C-q to 'quote' the C-m character in the substitution string :) > also is there a mail list focused specifically on emacs usability? > please refer me to it? There are at least 2 USENET newsgroups where GNU Emacs questions can be posted: comp.emacs gnu.emacs.help I'm not sure about mailing lists, though. Regards, Giorgos ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: replacing ^M with emacs
On 2006/10/27 11:26, Noah seems to have typed: > How might I get emacs to search replace Put a mark right before the character (control-space) move to right after the character and cut the character (control-w). Move to the top of the document (esc-<) and start a "query replace" (esc-%). Yank in the character that you previously cut (control-y). Hit return (or enter) type in the character that you want to replace the ^M with, hit return (or enter) again. Enter "y" or "n" for each case... ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"