VI question 
Author Message
 VI question

Can anyone tell me how to globally remove the carriage return character (
^M ) from a file in VI.

Peter Fripp
Inter-library Loan Support
epixtech, inc.



Sat, 05 Jun 2004 06:48:13 GMT
 VI question

Quote:

>Can anyone tell me how to globally remove the carriage return character (
>^M ) from a file in VI.

:%s/^V^M//

Now, where you see ^V you should actually press ctrl-V. At that point, vi
should either show ^ or ^V
then you press ctrl-M and you'll finally see

:%s/^M

so now, type in the closing slashes and away you go.

--
Space Corps Directive #997
Work done by an officer's doppleganger in a parallel
universe cannot be claimed as overtime.
    -- Red Dwarf
..  ... .--. .. -  --- -.  --- .-. .- -.-. .-.. .



Sat, 05 Jun 2004 08:08:58 GMT
 VI question
The previous response you got is right on the money.

However, if you happen to be using a Windows version of vi like VIM, if you
are using the GUI version, the ^V will do a paste, since that is the
standard Windows paste key.


Quote:

> Can anyone tell me how to globally remove the carriage return character (
> ^M ) from a file in VI.

> Peter Fripp
> Inter-library Loan Support
> epixtech, inc.



Sat, 05 Jun 2004 10:30:31 GMT
 VI question
Quote:

>The previous response you got is right on the money.

>However, if you happen to be using a Windows version of vi like VIM, if you
>are using the GUI version, the ^V will do a paste, since that is the
>standard Windows paste key.

hmmm - is there no alternative vi-escape key? ^V is the standard vi escape,
and of course the old favourite \ in other places. Nothing like UNIX for
powerful complications huh? A good port of vi for Windows would offer some
alternative to the ^V key 'cos it does an important job in vi.

I've got a windows version of vi called lemmy and it doesn't have this
problem. Unfortunately I can't find the distribution of lemmy any more! I
was given a fully functional demo years ago before we got internet aware,
but it looks like it's gone away. If anyone knows where to find Lemmy now
please pass it on.
--
Space Corps Directive #997
Work done by an officer's doppleganger in a parallel
universe cannot be claimed as overtime.
    -- Red Dwarf



Sat, 05 Jun 2004 11:09:44 GMT
 VI question

Quote:

> The previous response you got is right on the money.

> However, if you happen to be using a Windows version of vi like VIM, if you

I don't vi much on Windows, so I don't remember which vi clone it was I last
used, but that was an option you could set whether you wanted your
cut-and-paste commands to be invoked w/ Ctrl-key sequences.

Some Unix flavours also provide dos2ux and ux2dos which convert them for you -
can't remember which ones, but they're out there somewhere.

Quote:

> are using the GUI version, the ^V will do a paste, since that is the
> standard Windows paste key.



> > Can anyone tell me how to globally remove the carriage return character (
> > ^M ) from a file in VI.

> > Peter Fripp
> > Inter-library Loan Support
> > epixtech, inc.



Sat, 05 Jun 2004 12:44:19 GMT
 VI question

Here is an awk version of dos2unix:

awk 'BEGIN {RS="\r"} {printf("%s\n",$0)}' < input_file > output_file

Yeah, it's no longer in vi, but Andrew beat me to that one.

cheers
j.

Quote:
 ----- Original Message -----


Sent: Monday, December 17, 2001 5:48 PM
Subject: VI question

> Can anyone tell me how to globally remove the carriage return character (
> ^M ) from a file in VI.

> Peter Fripp
> Inter-library Loan Support
> epixtech, inc.



Sat, 05 Jun 2004 20:27:34 GMT
 VI question

This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_001_01C187C1.3CD5FFA0
Content-Type: text/plain

Lemmy 4.4 is available at http://www.softwareonline.org/

Andy

Quote:
-----Original Message-----

Sent: Monday, December 17, 2001 10:10 PM

Subject: Re: VI question


>The previous response you got is right on the money.

>However, if you happen to be using a Windows version of vi like VIM, if you
>are using the GUI version, the ^V will do a paste, since that is the
>standard Windows paste key.

hmmm - is there no alternative vi-escape key? ^V is the standard vi escape,
and of course the old favourite \ in other places. Nothing like UNIX for
powerful complications huh? A good port of vi for Windows would offer some
alternative to the ^V key 'cos it does an important job in vi.

I've got a windows version of vi called lemmy and it doesn't have this
problem. Unfortunately I can't find the distribution of lemmy any more! I
was given a fully functional demo years ago before we got internet aware,
but it looks like it's gone away. If anyone knows where to find Lemmy now
please pass it on.
--
Space Corps Directive #997
Work done by an officer's doppleganger in a parallel
universe cannot be claimed as overtime.
    -- Red Dwarf

------_=_NextPart_001_01C187C1.3CD5FFA0
Content-Type: text/html
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
5.5.2653.12">
<TITLE>RE: VI question</TITLE>
</HEAD>
<BODY>
<BR>

<P><FONT SIZE=3D2>Lemmy 4.4 is available at <A =
HREF=3D"http://www.softwareonline.org/" =
TARGET=3D"_blank">http://www.softwareonline.org/</A></FONT>
</P>

<P><FONT SIZE=3D2>Andy</FONT>
</P>

Quote:
<P><FONT SIZE=3D2>-----Original Message-----</FONT>

<BR><FONT SIZE=3D2>From: Andrew Hamm [<A =

] </FONT>
<BR><FONT SIZE=3D2>Sent: Monday, December 17, 2001 10:10 PM</FONT>

<BR><FONT SIZE=3D2>Subject: Re: VI question</FONT>
</P>
<BR>


<BR><FONT SIZE=3D2>&gt;The previous response you got is right on the =
money.</FONT>
<BR><FONT SIZE=3D2>&gt;</FONT>
<BR><FONT SIZE=3D2>&gt;However, if you happen to be using a Windows =
version of vi like VIM, if you</FONT>
<BR><FONT SIZE=3D2>&gt;are using the GUI version, the ^V will do a =
paste, since that is the</FONT>
<BR><FONT SIZE=3D2>&gt;standard Windows paste key.</FONT>
<BR><FONT SIZE=3D2>&gt;</FONT>
<BR><FONT SIZE=3D2>hmmm - is there no alternative vi-escape key? ^V is =
the standard vi escape,</FONT>
<BR><FONT SIZE=3D2>and of course the old favourite \ in other places. =
Nothing like UNIX for</FONT>
<BR><FONT SIZE=3D2>powerful complications huh? A good port of vi for =
Windows would offer some</FONT>
<BR><FONT SIZE=3D2>alternative to the ^V key 'cos it does an important =
job in vi.</FONT>
</P>

<P><FONT SIZE=3D2>I've got a windows version of vi called lemmy and it =
doesn't have this</FONT>
<BR><FONT SIZE=3D2>problem. Unfortunately I can't find the distribution =
of lemmy any more! I</FONT>
<BR><FONT SIZE=3D2>was given a fully functional demo years ago before =
we got internet aware,</FONT>
<BR><FONT SIZE=3D2>but it looks like it's gone away. If anyone knows =
where to find Lemmy now</FONT>
<BR><FONT SIZE=3D2>please pass it on.</FONT>
<BR><FONT SIZE=3D2>--</FONT>
<BR><FONT SIZE=3D2>Space Corps Directive #997</FONT>
<BR><FONT SIZE=3D2>Work done by an officer's doppleganger in a =
parallel</FONT>
<BR><FONT SIZE=3D2>universe cannot be claimed as overtime.</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp; -- Red Dwarf</FONT>
</P>
<BR>

</BODY>
</HTML>
------_=_NextPart_001_01C187C1.3CD5FFA0--



Sat, 05 Jun 2004 20:40:56 GMT
 VI question
Assuming you can get to a unix shell prompt, you could try
 cat txtfile.txt | tr -d "\015" > txtfile.unx

The octal code \015 is equivalent to Ctrl-V Ctrl-M,
and tr with the -d flag deletes strings that match
the argument.  tr is a filter, so you must cat the file
you wish to fix and capture the output to another file.



Sat, 05 Jun 2004 21:53:48 GMT
 VI question
Yes... while in VI enter this command

:g/^M/s///g


Quote:

> Can anyone tell me how to globally remove the carriage return character
> ^M ) from a file in VI.

> Peter Fripp
> Inter-library Loan Support
> epixtech, inc.



Sun, 06 Jun 2004 06:34:40 GMT
 VI question
There might be an alternate escape key other than ^V in the GUI version - I
don't know what it is though. VIM is an excellent vi-clone, and my guess is
that there is an alternative.

I use the Win32 console version of VIM and ^V works fine.  But there was
another guy in our office that installed the GUI version and ^V didn't work
(or else he installed the console version with mouse support or something
like that).  Something made ^V do a paste for him, but it works fine for me.
Neither of us messed specifically with key mappings, so I think it has
something to do with an install option.

Anyway, I posted my remark just in case ^V did a paste, so the original
poster didn't think the advice about ^V was wrong or didn't work.


Quote:

> >The previous response you got is right on the money.

> >However, if you happen to be using a Windows version of vi like VIM, if
you
> >are using the GUI version, the ^V will do a paste, since that is the
> >standard Windows paste key.

> hmmm - is there no alternative vi-escape key? ^V is the standard vi
escape,
> and of course the old favourite \ in other places. Nothing like UNIX for
> powerful complications huh? A good port of vi for Windows would offer some
> alternative to the ^V key 'cos it does an important job in vi.

> I've got a windows version of vi called lemmy and it doesn't have this
> problem. Unfortunately I can't find the distribution of lemmy any more! I
> was given a fully functional demo years ago before we got internet aware,
> but it looks like it's gone away. If anyone knows where to find Lemmy now
> please pass it on.
> --
> Space Corps Directive #997
> Work done by an officer's doppleganger in a parallel
> universe cannot be claimed as overtime.
>     -- Red Dwarf



Sun, 06 Jun 2004 08:25:18 GMT
 VI question
Quote:

>Anyway, I posted my remark just in case ^V did a paste, so the original
>poster didn't think the advice about ^V was wrong or didn't work.

And a wise move that was too ;-)

Taking care of our people. Who dares to claim there's something wrong with
the tone of our happy little newsgroup?



Sun, 06 Jun 2004 15:29:29 GMT
 VI question
Quote:

>Lemmy 4.4 is available at http://www.softwareonline.org/

Hey hey! and it appears to be a new release. Thanks.

PS - did u know that you are posting MIME HTML and some people find that
offensive? Or just plain difficult to read 'cos it doesn't render - the
problem I have since I disabled viewing MIME/HTML in Microsoft Virus
Express.



Sun, 06 Jun 2004 15:34:34 GMT
 VI question
Quote:

>Here is an awk version of dos2unix:

>awk 'BEGIN {RS="\r"} {printf("%s\n",$0)}' < input_file > output_file

>Yeah, it's no longer in vi, but Andrew beat me to that one.

Sorry to gazump you Jack, but you gotta remember there are two kinds of
people in this newsgroup: the quick and the hardworking.

And there are three kinds of people in this world: those who can count and
those who can't.



Sun, 06 Jun 2004 15:36:16 GMT
 VI question
Quote:

>Lemmy 4.4 is available at http://www.softwareonline.org/

I tried to search for it a few months ago, but all I got were websites for a
band called Motorhead.


Sun, 06 Jun 2004 15:51:18 GMT
 VI question

Actually I'm delighted.  Saved me the trouble of remembering and testing the
vi method - but then I can't remember if I test or not.

cheers
j.

Quote:
----- Original Message -----


Sent: Wednesday, December 19, 2001 2:36 AM
Subject: Re: VI question


> >Here is an awk version of dos2unix:

> >awk 'BEGIN {RS="\r"} {printf("%s\n",$0)}' < input_file > output_file

> >Yeah, it's no longer in vi, but Andrew beat me to that one.

> Sorry to gazump you Jack, but you gotta remember there are two kinds of
> people in this newsgroup: the quick and the hardworking.

> And there are three kinds of people in this world: those who can count and
> those who can't.



Sun, 06 Jun 2004 22:44:06 GMT
 
 [ 15 post ] 

 Relevant Pages 

1. DBAccess and "vi" Question (SE)

2. Unable to check out files in VI

3. Protocol Error in TDS stream from VI

4. SQL 6.5 (SP3) Keyset Error (VI-DFW)

5. web task problem in page with VI controls

6. SELECT TOP error in VI SQL Builder

7. ISQL: How do you set vi as your editor

8. Different Resultset from Same Query When Used as Stored procedure and When As Vi

9. Stored Procs from VI

10. VI San Support

11. VI SAN

12. Can't remotely connect to SQL Server using VI


 
Powered by phpBB® Forum Software