home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / editors / 1796 < prev    next >
Encoding:
Internet Message Format  |  1992-07-21  |  1.3 KB

  1. Path: sparky!uunet!zaphod.mps.ohio-state.edu!cs.utexas.edu!rutgers!modus!gear!cadlab!albani
  2. From: albani@cadlab.sublink.org (Lanfranco Albani)
  3. Newsgroups: comp.editors
  4. Subject: Re: How do I remove new-lines [CR,LF] in vi?
  5. Message-ID: <1992Jul21.093558.26214@cadlab.sublink.org>
  6. Date: 21 Jul 92 09:35:58 GMT
  7. References: <Brnt3s.5r6@x10siv.wariat.org> <1992Jul20.085426.619@alf.uib.no>
  8. Organization: CAD.LAB S.p.A., Bologna, Italia
  9. Lines: 29
  10.  
  11. buboo@alf.uib.no (Ove Ruben R Olsen) writes:
  12. :To remove the CRLF at the end of a line:  :%s/^V^M//
  13. :                          ^
  14. :                                              CTRL-V-CTRL-M
  15.  
  16. Use:    :%s/^V^M$//
  17. just in case you have some strange file format (^M in middle...)
  18.  
  19. :To remove blanklines (LF):  :%s/^$//
  20. :                                ^
  21. :                    NOT CTRL-$, but just ^ and $
  22.  
  23. Blank lines may have blanks and tabs, and they are not visible
  24. unless you use  :set list , so is better to use:
  25. :%s/^[     ][     ]*$//
  26. or
  27. :%s/^[     ]+$//
  28.  
  29. Between square brackets there are a blank and a tab.
  30.  
  31.  
  32. Bye, Lanfranco
  33.  
  34.  
  35. -- 
  36. Lanfranco Albani - CAD.LAB s.p.a., v. Ronzani 7/29, Casalecchio, Italia
  37. Email: (work:) albani@cadlab.sublink.org, (home:) bob@allan.sublink.org
  38. Phone: (work:) ++39 (51) 6130360, (home:) ++39 (51) 727372; 
  39. Fax: ++39 (51) 6130294 (work only), Fidonet: 2:332/407.1138 (home only).
  40.