Re: [PHP-DB] I have a CR-LF problem when pulling stuff out of my DB
On Fri, 20 Aug 2004 01:31, Michael Cortes wrote: > I found part of the answer.. > > when doing a search in vim you can hit ctrl-m as long as you hit ctrl-v > first. ctrl-v tells vim to treat the following as a character, not to do > the action i.e... carriage return. > > Now I need just one more piece, if anyone has the answer: > > ctrl-m is a carriage return. Does anyone know what ctrl seqence is line > feed? > > Thanks Add these to your list of useful vim character codes: Ctrl-H = Backspace Ctrl-I = horizontal tab Ctrl-J = Line feed Ctrl-K = vertical tab Ctrl-L = form feed Cheers -- David Robley "Would you like to buy an alarm?" asked Tom self-righteously. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] I have a CR-LF problem when pulling stuff out of my DB
Maybe I'm missing something...but why not do this with PHP (seeing as how this is a PHP list)? ereg_replace('(\r|\n)', ' ', $string) Just a thought On Thu, 19 Aug 2004 12:01:46 -0400, Michael Cortes <[EMAIL PROTECTED]> wrote: > I found part of the answer.. > > when doing a search in vim you can hit ctrl-m as long as you hit ctrl-v first. > ctrl-v tells vim to treat the following as a character, not to do the action > i.e... carriage return. > > Now I need just one more piece, if anyone has the answer: > > ctrl-m is a carriage return. Does anyone know what ctrl seqence is line feed? > > Thanks > > > > On Thursday 19 August 2004 09:49 am, Michael Cortes wrote: > > That didn't work. Here's why. This is not a dos file. It is a unix file > > but when dumping the data from my db, some fields had a trailing CR and LF. > > So what I ended up with was a ^M showing in the middle of a line when I > > open the file in vim. And... the lines will also end where they shouldn't. > > What is supposed to be one line, then continues on the next. > > > > While dos2unix did strip out the ^m, it left the LF (is it return or > > linefeed in unix) at the end of the line, starting a new one. > > > > I need to actually do a search on ^M followed by LF and replace it with > > nothing so I get my full line back. But I don't know how to enter in LF or > > CR in a vim search string. > > > > Hope this clarifies. > > > > -- > > Michael Cortes > Fort LeBoeuf School District > 34 East Ninth Street > PO Box 810 > Waterford PA 16441-0810 > 814.796.4795 > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- randy [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] I have a CR-LF problem when pulling stuff out of my DB
On 19 August 2004 17:02, Michael Cortes wrote: > ctrl-m is a carriage return. Does anyone know what ctrl seqence is > line feed? ctrl-j (CR and LF are ASCII codes 13 and 10, so ctrl+ the 13th and 10th letters of the alphabet respectively!) Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning & Information Services, JG125, James Graham Building, Leeds Metropolitan University, Headingley Campus, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] I have a CR-LF problem when pulling stuff out of my DB
I found part of the answer.. when doing a search in vim you can hit ctrl-m as long as you hit ctrl-v first. ctrl-v tells vim to treat the following as a character, not to do the action i.e... carriage return. Now I need just one more piece, if anyone has the answer: ctrl-m is a carriage return. Does anyone know what ctrl seqence is line feed? Thanks On Thursday 19 August 2004 09:49 am, Michael Cortes wrote: > That didn't work. Here's why. This is not a dos file. It is a unix file > but when dumping the data from my db, some fields had a trailing CR and LF. > So what I ended up with was a ^M showing in the middle of a line when I > open the file in vim. And... the lines will also end where they shouldn't. > What is supposed to be one line, then continues on the next. > > While dos2unix did strip out the ^m, it left the LF (is it return or > linefeed in unix) at the end of the line, starting a new one. > > I need to actually do a search on ^M followed by LF and replace it with > nothing so I get my full line back. But I don't know how to enter in LF or > CR in a vim search string. > > Hope this clarifies. > -- Michael Cortes Fort LeBoeuf School District 34 East Ninth Street PO Box 810 Waterford PA 16441-0810 814.796.4795 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] I have a CR-LF problem when pulling stuff out of my DB
That didn't work. Here's why. This is not a dos file. It is a unix file but when dumping the data from my db, some fields had a trailing CR and LF. So what I ended up with was a ^M showing in the middle of a line when I open the file in vim. And... the lines will also end where they shouldn't. What is supposed to be one line, then continues on the next. While dos2unix did strip out the ^m, it left the LF (is it return or linefeed in unix) at the end of the line, starting a new one. I need to actually do a search on ^M followed by LF and replace it with nothing so I get my full line back. But I don't know how to enter in LF or CR in a vim search string. Hope this clarifies. On Thursday 19 August 2004 08:50 am, Russell Johnson wrote: > Actually, an easier tool to use is dos2unix, which is available on most > Linux boxes. Just type dos2unix [filename], and you should be all set. > > -Mensaje original- > De: Michael Cortes [mailto:[EMAIL PROTECTED] > Enviado el: Thursday, August 19, 2004 1:36 PM > Para: [EMAIL PROTECTED] > Asunto: [PHP-DB] I have a CR-LF problem when pulling stuff out of my DB > > However, I now have an immediate need. I want to open these five files in > vim and find and replace the ^M in every instance. I know how to find and > replace (:g/find//s/replace/g). But I cannot get the ^M in the string. If > I actually hit it reads as a return; if I type ^M using the > shift-6 then it looks for the actual characters. > > Can anyone help? > -- Michael Cortes Fort LeBoeuf School District 34 East Ninth Street PO Box 810 Waterford PA 16441-0810 814.796.4795 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] I have a CR-LF problem when pulling stuff out of my DB
Actually, an easier tool to use is dos2unix, which is available on most Linux boxes. Just type dos2unix [filename], and you should be all set. - Russ Johnson Sabadell Spain -Mensaje original- De: Michael Cortes [mailto:[EMAIL PROTECTED] Enviado el: Thursday, August 19, 2004 1:36 PM Para: [EMAIL PROTECTED] Asunto: [PHP-DB] I have a CR-LF problem when pulling stuff out of my DB This may not be exaxtly PHP-DB related but it is a result of screwing something up . I pulled a bunch of data from a DOS formatted tab seperated file and now I am dumping back out into a text file (on linux). So, as you can imagine, I ended up with a bunch of ^M throughout the file. I plan on fixing this. The solution is easy enough. I just need to remember to open the text files in vim and save as unix files. However, I now have an immediate need. I want to open these five files in vim and find and replace the ^M in every instance. I know how to find and replace (:g/find//s/replace/g). But I cannot get the ^M in the string. If I actually hit it reads as a return; if I type ^M using the shift-6 then it looks for the actual characters. Can anyone help? -- Michael Cortes Fort LeBoeuf School District 34 East Ninth Street PO Box 810 Waterford PA 16441-0810 814.796.4795 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] I have a CR-LF problem when pulling stuff out of my DB
This may not be exaxtly PHP-DB related but it is a result of screwing something up . I pulled a bunch of data from a DOS formatted tab seperated file and now I am dumping back out into a text file (on linux). So, as you can imagine, I ended up with a bunch of ^M throughout the file. I plan on fixing this. The solution is easy enough. I just need to remember to open the text files in vim and save as unix files. However, I now have an immediate need. I want to open these five files in vim and find and replace the ^M in every instance. I know how to find and replace (:g/find//s/replace/g). But I cannot get the ^M in the string. If I actually hit it reads as a return; if I type ^M using the shift-6 then it looks for the actual characters. Can anyone help? -- Michael Cortes Fort LeBoeuf School District 34 East Ninth Street PO Box 810 Waterford PA 16441-0810 814.796.4795 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php