🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.editors
Article #2711

Re: How to insert a space down a table, using vi?

#2711
From: Rouben Rostamian
Date: Tue, 28 May 1991 21:41
22 lines
1542 bytes
In article <4016@ux.acs.umn.edu> mark-d@wagner.cbs.umn.edu (Mark Dalton) writes:
>Hi! I was wondering how I can insert a space in the same position
>in each line down a table, starting with the second line.

To insert a space following the fourth character in every line starting on
line 2 using vi, do

:2,$s/..../& /

Recall that the special character "&" is replaced with the pattern
matched in the previous expression.

There may be numerous variations on this theme; but you've got the idea.

With large files you may prefer using sed rather that vi, as in:
tail +2 infile | sed 's/..../& /' >outfile

--
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: <1991May28.214142.8549@umbc3.umbc.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!asuvax!ncar!elroy.jpl.nasa.gov!sdd.hp.com!zaphod.mps.ohio-state.edu!sample.eng.ohio-state.edu!purdue!haven.umd.edu!umbc3.umbc.edu!math9.math.umbc.edu!rouben
References: <4016@ux.acs.umn.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!asuvax!ncar!elroy.jpl.nasa.gov!sdd.hp.com!zaphod.mps.ohio-state.edu!sample.eng.ohio-state.edu!purdue!haven.umd.edu!umbc3.umbc.edu!math9.math.umbc.edu!rouben
From: rouben@math9.math.umbc.edu (Rouben Rostamian)
Newsgroups: comp.editors
Subject: Re: How to insert a space down a table, using vi?
Message-ID: <1991May28.214142.8549@umbc3.umbc.edu>
Date: 28 May 91 21:41:42 GMT
References: <4016@ux.acs.umn.edu>
Sender: newspost@umbc3.umbc.edu (News  posting account)
Distribution: na
Organization: University of Maryland Baltimore County, Mathmatics Department
Lines: 22