Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!rutgers!psuvax1!vu-vlsi!devon!paul From: paul@devon.UUCP Newsgroups: comp.unix.questions Subject: Re: Invisible Ascii with VI Message-ID: <469@devon.UUCP> Date: Mon, 28-Sep-87 00:03:36 EDT Article-I.D.: devon.469 Posted: Mon Sep 28 00:03:36 1987 Date-Received: Tue, 29-Sep-87 01:29:45 EDT References: <258@unx1.UUCP> Reply-To: paul@devon.UUCP (Paul Sutcliffe Jr.) Distribution: world Organization: Devon Computer Services, Allentown, PA Lines: 27 Keywords: vi Summary: your command was wrong In article <258@unx1.UUCP> andy@unx1.UUCP (Andy Clews) writes: > Specifically: I sometimes get files from a net source that have an "extra" > CR tacked on the end of the line, and VI shows them as ^M on the screen. > For various reasons these are a pain. I'd like to be able to get rid of > them with, say, a global substitute. I've tried 1,$s/^V^M$// but this > does not seem to do what I want. > I'd appreciate email replies if any. I thought this reply might be of general interest, so I'm posting it. Your "1,$s/^V^M$//" didn't work because the search pattern didn't match anything in your text file. You asked vi to find all lines where the character just before the end of line ($) was a carriage-return. This pattern will not match because the lines in your text were terminated by a CR/LF pair, so there was a line-feed between the "^M" and the "$". A better way to do this would have been "1,$s/^V^M//". This would replace all occurrances of ^M with nothing. You don't need an end-of-line indicator as there are (should be) no other ^M's in the text. - paul -- Paul Sutcliffe, Jr. UUCP (smart): paul@devon.UUCP UUCP (dumb): ...{rutgers,ihnp4,cbosgd}!bpa!vu-vlsi!devon!paul