billd@infmx.informix.com (William Daul) (06/19/91)
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? Thanks, --Bi((
rouben@math16.math.umbc.edu (Rouben Rostamian) (06/19/91)
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
carlson@mrx.webo.dg.com (James Carlson) (06/19/91)
Minor oops. I think you meant: :%s/^\(..........\)........./\1/ -- Disclaimer: I cannot speak for Data General. You should have guessed that. Mail to: carlson@mrx.webo.dg.com -or- James_Carlson@dgc.mceo.dg.com .//.