home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / unix / misc / 4778 < prev    next >
Encoding:
Text File  |  1992-12-31  |  1.3 KB  |  46 lines

  1. Newsgroups: comp.unix.misc
  2. Path: sparky!uunet!cs.utexas.edu!sun-barr!ames!data.nas.nasa.gov!wilbur.nas.nasa.gov!hampe
  3. From: hampe@wilbur.nas.nasa.gov (Andrew F. Hampe)
  4. Subject: Re: Regular expression, vi and sed
  5. Keywords: RE, VI, SED
  6. References: <1992Dec24.050436.13946@organpipe.uug.arizona.edu> <1992Dec24.234801.20080@netcom.com>
  7. Sender: news@nas.nasa.gov (News Administrator)
  8. Organization: OnlyWhereRequiredByLaw
  9. Date: Thu, 31 Dec 92 07:01:18 GMT
  10. Message-ID: <1992Dec31.070118.17956@nas.nasa.gov>
  11. Lines: 33
  12.  
  13. In article <1992Dec24.234801.20080@netcom.com> messina@netcom.com (Tony Porczyk) writes:
  14. >ron@argus.lpl.Arizona.EDU (Ron Watkins) writes:
  15. >
  16. >>I have a problem which I don't understand. First, I would like to delete
  17. >>a bunch of blank spaces that I have in a very large file. VI can't do it
  18. >>because there isn't enough space in /var or /tmp or whatever. So I tried
  19. >>using sed as follows:
  20. >>sed -e "s/^ +//" < in > out"
  21. >>and it didn't work.
  22. >
  23. >Try:
  24. >
  25. >sed -e "s/^[ ]*//" < in > out
  26. >
  27. >t.
  28.  
  29. how about:
  30.  
  31.     sed -e 's/[ ][ ]*/ /g' < in > out
  32.  
  33. this would reduce all occurances of more than one space to
  34. just one space on any given line.
  35.  
  36. the bit with the "^" is limiting it to just the start of
  37. the lines, or am I missing why we are trying to deal with
  38. only the starts of lines?
  39.  
  40.  
  41. ciao
  42. drieux
  43.  
  44.  
  45.  
  46.