Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

vi column replacement 1

Status
Not open for further replies.

mrrioux

IS-IT--Management
Jun 13, 2001
3
US
I have a list of text with which I am trying to replace any entry in the 18 to the 21 position with spaces.

in effect
aabbccddeeffgghhiijjkkll
with
aabbccddeeffgghhi kkll
Does anyone know an easy way to do this?
The 18 to 21 position is varied so a text replacement cannot be done.

Thank you for your time.
Mrr
 
Try

%s/\(.\{17\}\)..../\1 /

Some older versions of vi do not allow the repeat count \{17\} so you may need to replace it with 16 periods. Some newer versions and vi clones don't require you to escape the curly braces e.g. Elvis and Vim.

Hope this helps.

CaKiwi
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top