Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!sundc!pitstop!sun!amdcad!ames!sdcsvax!ucsdhub!hp-sdd!hplabs!hpcea!hpfcdc!hpldola!hp-lsd!hplsdly!hplsdlw!was From: was@hplsdlw.HP.COM (William A. Stubblebine) Newsgroups: comp.unix.questions Subject: Re: Invisible Ascii with VI Message-ID: <630001@hplsdlw.HP.COM> Date: Mon, 28-Sep-87 19:03:01 EDT Article-I.D.: hplsdlw.630001 Posted: Mon Sep 28 19:03:01 1987 Date-Received: Sun, 4-Oct-87 20:46:26 EDT References: <258@unx1.UUCP> Organization: HP Logic System Div. - ColoSpgs, CO Lines: 54 > / hplsdlw:comp.unix.questions / andy@unx1.UUCP (Andy Clews): > Does anyone out there know if it's possible to insert/search/replace > non-printing ascii characters? > Specifically: I sometimes get files from a net source that have an "extra" > CR tacked on the end of the line ... Vi will insert non-printing characters (e.g., ^M) using the ^V escape. That is, if you input ^V^M in insert mode, ^M goes into the buffer. (Everywhere, that is, except the end of a line, where :s/$/^V^M/ does work). Vi will also accept escaped ^M characters as search patterns, e.g. :s/^V^M$//g should remove your trailing ^M's. (I've uploaded a few XMODEM files myself!) Unfortunately, many versions if ex/vi have a bug in handling ^M as a replacement pattern via ex while in visual mode. That is, typing :s/;/\^M/g to change hello;goodbye into hello goodbye while in visual mode doesn't work. The ^M isn't interpreted as the replacement pattern, it just terminates the command. However, if you drop into ex mode (type 'Q'), then type s/;/\ /g Then type 'vi' to return to visual mode you should get what you want. That is, you leave vi, do your substitute in ex and return as follows: Qs/;/\ /g vi Good luck. Bill Stubblebine Hewlett-Packard Logic Systems Div. 8245 N. Union Blvd. Colorado Springs, Co. 80918 ...!ihnp4!hpfcla!hpldola!was (303) 590-5568