RE: Substitute command on vi
I use the following: :.,$s/^M//g For ^M, you have to press Ctrl-V and then Best regards, Ilias --- Fraunhofer IGD Department Cognitive Computing & Medical Imaging Ilias Sachpazidis phone:+49/(0)/6151/155 507 Fraunhoferstr. 5 fax :+49/(0)/6151/155 480 D-64283 Darmstadt [EMAIL PROTECTED] Germany http://www.igd.fhg.de/~isachpaz --- -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Aguiar Magalhaes Sent: Friday, May 05, 2006 3:12 PM To: freebsd-questions@freebsd.org Subject: Substitute command on vi Hi list, I need to substitute a lot of characters ^M (ctrl+M) at the end of each line in my file. The command :%s/^M//g insn't have success. How can i do it ? Thanks, Aguiar ___ Abra sua conta no Yahoo! Mail: 1GB de espaço, alertas de e-mail no celular e anti-spam realmente eficaz. http://br.info.mail.yahoo.com/ ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]" ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
RE: Substitute command on vi
This is a good vi incantation (NB The ^V is only there to allow you to put in the ^M. The ^V doesnt show in the final command line, so dont panic that you cant see it) :g/^V^M/s///g ie g/^V^M/ - find a ^M (any one will do, you dont need to be at the file start) s/// - substitute nothing for the ^M just found g - do this to all other ^M's mjt -- "Any intelligent fool can make things bigger and more complex... It takes a touch of genius - and a lot of courage to move in the opposite direction." Albert Einstein -- > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Denis R. > Sent: Saturday, 6 May 2006 3:40 AM > To: [EMAIL PROTECTED] > Cc: freebsd-questions@freebsd.org > Subject: re: Substitute command on vi > > Try > #dos2unix file_name > > >>>>>>>>>> > Hi list, > > I need to substitute a lot of characters ^M (ctrl+M) at the > end of each line in my file. > > The command :%s/^M//g insn't have success. > > How can i do it ? > > Thanks, > > Aguiar --- The information transmitted in this e-mail is for the exclusive use of the intended addressee and may contain confidential and/or privileged material. Any review, re-transmission, dissemination or other use of it, or the taking of any action in reliance upon this information by persons and/or entities other than the intended recipient is prohibited. If you received this in error, please inform the sender and/or addressee immediately and delete the material. E-mails may not be secure, may contain computer viruses and may be corrupted in transmission. Please carefully check this e-mail (and any attachment) accordingly. No warranties are given and no liability is accepted for any loss or damage caused by such matters. --- ***This Email has been scanned for Viruses by MailMarshal.*** ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
re: Substitute command on vi
Try #dos2unix file_name >> Hi list, I need to substitute a lot of characters ^M (ctrl+M) at the end of each line in my file. The command :%s/^M//g insn't have success. How can i do it ? Thanks, Aguiar ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: Substitute command on vi
On Fri, 2006-05-05 at 10:12 -0300, Aguiar Magalhaes wrote: > Hi list, > > I need to substitute a lot of characters ^M (ctrl+M) > at the end of each line in my file. > > The command :%s/^M//g insn't have success. > > How can i do it ? > > Thanks, > > Aguiar > > > > ___ > Abra sua conta no Yahoo! Mail: 1GB de espaço, alertas de e-mail no celular e > anti-spam realmente eficaz. > http://br.info.mail.yahoo.com/ > ___ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to "[EMAIL PROTECTED]" > I also has it problem. I'm in Midnight Commander copy symbol '^M' and paste to my script instead (see below) :-/ script: sed -e 's/$//g' filename > filename.copy It work. :) -- Kalashnikov Ilya <[EMAIL PROTECTED]> ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: Substitute command on vi
On 2006-05-05 10:12, Aguiar Magalhaes <[EMAIL PROTECTED]> wrote: > Hi list, > > I need to substitute a lot of characters ^M (ctrl+M) > at the end of each line in my file. > > The command :%s/^M//g insn't have success. The command looks fine, except for a tiny detail: Make sure you use ^V ^M to insert a *literal* ^M character in the match pattern, instead of two different characters '^' and 'M'. Then it should work. ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: Substitute command on vi
On Fri, May 05, 2006 at 10:12:02AM -0300, Aguiar Magalhaes wrote: > I need to substitute a lot of characters ^M (ctrl+M) > at the end of each line in my file. You might wanna give dos2unix a try: /usr/local/bin/dos2unix > The command :%s/^M//g insn't have success. Is this a shift+6 M, or a ctrl+V ctrl+M? The last one should work. -- Riemer PalstraAmsterdam, The Netherlands [EMAIL PROTECTED]http://www.palstra.com/ ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: Substitute command on vi
El día Friday, May 05, 2006 a las 10:12:02AM -0300, Aguiar Magalhaes escribió: > Hi list, > > I need to substitute a lot of characters ^M (ctrl+M) > at the end of each line in my file. > > The command :%s/^M//g insn't have success. > > How can i do it ? :1,$s-.$-- matthias -- Matthias Apitz Manager Technical Support - OCLC PICA GmbH Gruenwalder Weg 28g - 82041 Oberhaching - Germany t +49-89-61308 351 - f +49-89-61308 399 - m +49-170-4527211 e <[EMAIL PROTECTED]> - w http://www.oclcpica.org/ ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"