Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!bbn!bbn.com!mesard From: mesard@bbn.com (Wayne Mesard) Newsgroups: comp.emacs Subject: Re: script files Summary: M-x query-replace-regexp [^@-^H^K^M-^_]+ Message-ID: <36466@bbn.COM> Date: 27 Feb 89 15:03:23 GMT References: <517@cwjcc.CWRU.Edu> Sender: news@bbn.COM Reply-To: mesard@BBN.COM (Wayne Mesard) Distribution: usa Organization: Bolt Beranek and Newman Inc., Cambridge MA Lines: 32 In article <517@cwjcc.CWRU.Edu> yehuda@victoria.UUCP (Yechiel Yehuda) writes: > Is there any way to *quickly* clean a file of control characters > in Emacs? Well how *quickly* can you type the following (when you're at the top of the buffer): => x query-replace-regexp This runs the Query Replace Regexp command. => [- -]+ This results in: "[^@-^H^K^M-^_]+" and is a regular expression describing a string of one or more control chars (excluding Tabs, Linefeeds and page breaks). => Enters an empty replacement string. => ! Tells Emacs to do all the replacements it can without asking you to confirm them. [It's not as difficult as my verbose description makes it sound. It can be done in two dozen keystrokes, actually.] The above assumes you're using GNU Emacs, although you didn't say:-( Disclaimer: For the next two weeks people will be sending you elisp code to do what you've asked. Don't worry, they mean well :-) -- unsigned *Wayne_Mesard(); MESARD@BBN.COM BBN, Cambridge, MA