About vim
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Unix support > Unix Programming > About vim




Pages (2): [1] 2 »   Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    About vim  
Marmagya


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
02-23-04 11:33 PM

Hi,
I have a text file which I am opening in vi/vim/gvim. I want to
replace a particular character with a newline character. How can I do it?
For ex, I have the file containing line:

I am a good boy.^MI am regular at work.

Now I want to replace this '^M' with a new line. In other words, what
should I relplace '??' with in the following search and replace command:

:%s/CtrlV+M/??/g

Regards
Marmagya






[ Post a follow-up to this message ]



    Re: About vim  
Maurizio Loreti


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
02-24-04 12:33 AM

Marmagya <marmagya@eNOpatra_SPAM.com> writes:

>        I have a text file which I am opening in vi/vim/gvim. I want to
> replace a particular character with a newline character. How can I do
> it?

Depends from what a newline character is on your platform.  On mine is
a ^J, on your I dunno.

--
Maurizio Loreti                         [url]http://www.pd.infn.it/~loreti/mlo.html[/ur
l]
Dept. of Physics, Univ. of Padova, Italy              ROT13: [email]ybergv@cq.vasa.vg[/emai
l]





[ Post a follow-up to this message ]



    Re: About vim  
Peter Jensen


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
02-24-04 12:33 AM

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Marmagya wrote:

> I have a text file which I am opening in vi/vim/gvim. I want to
> replace a particular character with a newline character. How can I do
> it?  For ex, I have the file containing line:
>
> I am a good boy.^MI am regular at work.

Would this by any chance be a DOS or MAC text file?  In that case just
use the conversion tools dos2unix or mac2unix.

> Now I want to replace this '^M' with a new line. In other words, what
> should I relplace '??' with in the following search and replace
> command:
>
> :%s/CtrlV+M/??/g

That would probably be '\r'.

[Followup-To: comp.os.linux.advocacy]

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

 iD8DBQFAOxS3d1ZThqotgfgRAm22AKCUgbBgIqcX
F3ZlR5US95D3qqIQCgCeKd21
b1/sIgNpyO7594XGIzHsgGo=
=WWmG
-----END PGP SIGNATURE-----
--
PeKaJe

Americans' greatest fear is that America will turn out to have been a
phenomenon, not a civilization.  -- Shirley Hazzard, "Transit of Venus"





[ Post a follow-up to this message ]



    Re: About vim  
Jim Richardson


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
02-24-04 01:33 AM

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Tue, 24 Feb 2004 13:34:20 +0530,
Marmagya <marmagya@eNOpatra_SPAM.com> wrote:
> Hi,
>        I have a text file which I am opening in vi/vim/gvim. I want to
> replace a particular character with a newline character. How can I do it?
> For ex, I have the file containing line:
>
> I am a good boy.^MI am regular at work.
>
> Now I want to replace this '^M' with a new line. In other words, what
> should I relplace '??' with in the following search and replace command:
>
>:%s/CtrlV+M/??/g
>
> Regards
> Marmagya
>
:%s/CtrlV^M/\r/g


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

 iD8DBQFAOxpvd90bcYOAWPYRAnvuAJwP1VaGIPy6
M2XkeDZ+L/6vrqFULgCgttgq
p+uh6mEg3ULCCwSYyTEoad8=
=4qpm
-----END PGP SIGNATURE-----

--
Jim Richardson     http://www.eskimo.com/~warlock
Why is the symbol for anarchy always written the same way?





[ Post a follow-up to this message ]



    Re: About vim  
Donn Miller


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
02-24-04 02:33 AM

Marmagya wrote:
> Hi,
>       I have a text file which I am opening in vi/vim/gvim. I want to
> replace a particular character with a newline character. How can I do it?
> For ex, I have the file containing line:
>
> I am a good boy.^MI am regular at work.
>
> Now I want to replace this '^M' with a new line. In other words, what
> should I relplace '??' with in the following search and replace command:
>
> :%s/CtrlV+M/??/g

How about :

sed 's/\r/\n/g' somefile > newfile

Or,

perl -pi -e 's/\r/\n/g' somefile

I usually like to use a comma instead of a forward-slash as my
delimeter, though it doesn't matter, as long as the same delimiter is
used througout.


-----= Posted via webservertalk.com, Uncensored Usenet News =-----
http://www.webservertalk.com - The #1 Newsgroup Service in the World!
-----==  Over 100,000 Newsgroups - 19 Different Servers! =-----





[ Post a follow-up to this message ]



    Re: About vim  
The Onion Man


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
02-24-04 07:34 AM

Marmagya sighed and said:

> Hi,
>        I have a text file which I am opening in vi/vim/gvim. I want to
> replace a particular character with a newline character. How can I do it?
> For ex, I have the file containing line:
>
> I am a good boy.^MI am regular at work.
>
> Now I want to replace this '^M' with a new line. In other words, what
> should I relplace '??' with in the following search and replace command:
>
> :%s/CtrlV+M/??/g
>
> Regards
> Marmagya

There is the utility fromdos which according to its man page

takes a DOS text file as stdin and sends a UNIX text file
to stdout.  DOS text file format separates lines of  text  by  two
characters:  CR  followed by LF (hex 0d 0a). UNIX text file format
separates lines of text with a single LF character (hex 0a).  This
program  changes  the CR LF groups found in the input stream to LF
in the output stream.

I know this is outside of vim, but it might just work...

--
Ian

I fought Windows from 95 to 2000.
It beat me every time.
That's why I use Linux.






[ Post a follow-up to this message ]



    Re: About vim  
cola_moderator


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
02-24-04 01:34 PM

Donn Miller <dmmiller@cvzoom.net> wrote in message news:<403b251e$1_2@corp.newsgroups.co
m>...
> Marmagya wrote: 
>
> How about :
>
> sed 's/\r/\n/g' somefile > newfile
>
> Or,
>
> PERL -pi -e 's/\r/\n/g' somefile
>
> I usually like to use a comma instead of a forward-slash as my
> delimeter, though it doesn't matter, as long as the same delimiter is
> used througout.

...or you can forget about the past and fast forwared to the future
... dump all that retarded goofy old-fashined beta linux software and
upgrade to one of the many top quality text editor available under
windows xp professional ... forget about vi, vim, gvim and all that
crap, that's only for morons!





[ Post a follow-up to this message ]



    Re: About vim  
Rich Teer


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
02-24-04 02:34 PM

On Tue, 24 Feb 2004, cola_moderator wrote:

> ...or you can forget about the past and fast forwared to the future
> ... dump all that retarded goofy old-fashined beta linux software and
> upgrade to one of the many top quality text editor available under
> Windows XP professional ... forget about vi, vim, gvim and all that
> crap, that's only for morons!

___________________
/|  /|  |                  |
||__||  |      Please do   |
/   O O\__         NOT      |
/          \     feed the    |
/      \     \     trolls     |
/   _    \     \ ______________|
/    |\____\     \     ||
/     | | | |\____/     ||
/       \|_|_|/   \    __||
/  /  \            |____| ||
/   |   | /|        |      --|
|   |   |//         |____  --|
* _    |  |_|_|_|          |     \-/
*-- _--\ _ \     //           |
/  _     \\ _ //   |        /
*  /   \_ /- | -     |       |
*      ___ c_c_c_C/ \C_c_c_c____________

--
Rich Teer, SCNA, SCSA

President,
Rite Online Inc.

Voice: +1 (250) 979-1638
URL: http://www.rite-online.net





[ Post a follow-up to this message ]



    Re: About vim  
joe@invalid.address


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
02-24-04 02:34 PM

Rich Teer <rich.teer@rite-group.com> writes:

[...]

>                                   ___________________
>                           /|  /|  |                  |
>                           ||__||  |      Please do   |
>                          /   O O\__         NOT      |
>                         /          \     feed the    |
>                        /      \     \     trolls     |
>                       /   _    \     \ ______________|
>                      /    |\____\     \     ||
>                     /     | | | |\____/     ||
>                    /       \|_|_|/   \    __||
>                   /  /  \            |____| ||
>                  /   |   | /|        |      --|
>                  |   |   |//         |____  --|
>           * _    |  |_|_|_|          |     \-/
>        *-- _--\ _ \     //           |
>          /  _     \\ _ //   |        /
>        *  /   \_ /- | -     |       |
>          *      ___ c_c_c_C/ \C_c_c_c____________

Good one. Mind if I steal it for future use?

I know a couple trolls who will complain about it as a waste of
bandwidth. Funny how trolls always accuse others of what they do.

Joe
--
"I didn't really say everything I said."
- Yogi Berra





[ Post a follow-up to this message ]



    Re: About vim  
Rich Teer


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
02-24-04 05:34 PM

On Tue, 24 Feb 2004 joe@invalid.address wrote:

> Good one. Mind if I steal it for future use?

Not at all - go right ahead!

> I know a couple trolls who will complain about it as a waste of
> bandwidth. Funny how trolls always accuse others of what they do.

Indeed...

--
Rich Teer, SCNA, SCSA

President,
Rite Online Inc.

Voice: +1 (250) 979-1638
URL: http://www.rite-online.net





[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 08:25 AM.      Post New Thread    Post A Reply      
Pages (2): [1] 2 »   Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register