Operating System - HP-UX
1825705 Members
3248 Online
109686 Solutions
New Discussion

Re: vi / substitution help

 
SOLVED
Go to solution
Mike_Ca Li
Regular Advisor

vi / substitution help

Hi:
I have a file with first 4 colums with digits and the rest with characters. I would liek to add a space behind the 4th digit. Thanks.
1234absc
5678detg
..
4567abfcd

how to get

1234 absc
5678 detg
..
4567 abfcd
2 REPLIES 2
Vitek Pepas
Valued Contributor
Solution

Re: vi / substitution help

Try this:
cat file | sed -e 's/\(....\)/\1\ /'
curt larson_1
Honored Contributor

Re: vi / substitution help

within vi you could try:

$s/^..../& /
or
$s/^\(....\)/\1 /