Article View: comp.editors
Article #2837Re: Removing Text Between Specific Columns in VI
From: Rouben Rostamian
Date: Wed, 19 Jun 1991 02:19
Date: Wed, 19 Jun 1991 02:19
41 lines
1812 bytes
1812 bytes
In article <1991Jun18.215011.16306@informix.com> billd@infmx.informix.com (William Daul) writes: >Given a file looking like this: > >12345678-1-2345678-2-2345678-3 >blah blah blah stuff more >45345454 blah blah more stuff >44 55 66 gg tt hh rr fgjgfkjk >. >. >. >last line big deal...the end > > >What if I wanted to remove everything between >column 10 and column 20 on ALL lines. Can it >be done in vi? Sure. Everything can be done in vi! Not that you would want to :-) Here are three suggestions: 1. You may be happier using the "cut" utility, if your machine has it. To retain columns 1-10 and 20 and up; i.e., to remove columns 11-19, do: cut -c1-10,20- oldfile >newfile 2. If you insist in doing it with vi, here it is: :%s/\(..........\)........./\1/ 3. If you feel ambitious enough, you can call "cut" within vi, as in: :% !cut -c1-10,20- Enjoy! -- Rouben Rostamian Telephone: (301) 455-2458 Department of Mathematics and Statistics e-mail: University of Maryland Baltimore County bitnet: rostamian@umbc.bitnet Baltimore, MD 21228, U.S.A. internet: rouben@math9.math.umbc.edu
Technical Details
Message-ID:
<1991Jun19.021913.11075@umbc3.umbc.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!aplcen!boingo.med.jhu.edu!haven.umd.edu!umbc3.umbc.edu!math16.math.umbc.edu!roubenReferences:
<1991Jun18.215011.16306@informix.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!aplcen!boingo.med.jhu.edu!haven.umd.edu!umbc3.umbc.edu!math16.math.umbc.edu!rouben From: rouben@math16.math.umbc.edu (Rouben Rostamian) Newsgroups: comp.editors Subject: Re: Removing Text Between Specific Columns in VI Message-ID: <1991Jun19.021913.11075@umbc3.umbc.edu> Date: 19 Jun 91 02:19:13 GMT References: <1991Jun18.215011.16306@informix.com> Sender: newspost@umbc3.umbc.edu (News posting account) Organization: University of Maryland Baltimore County, Mathmatics Department Lines: 41