Languages and Scripting
Showing results for 
Search instead for 
Do you mean 

insert spaces in a word

Occasional Contributor

insert spaces in a word

Hello,
This is the string what i have which is continous.
/dev/dsk/c3t2d0s3/dev/rdsk/c3t2d0s3

now which command i need to use to get the string as below.

/dev/dsk/c3t2d0s3 /dev/rdsk/c3t2d0s3
3 REPLIES
Honored Contributor Honored Contributor

Re: insert spaces in a word

hi,

try:

:1,$s/\/dev/ \/dev/g


kind regards
yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
Honored Contributor Honored Contributor

Re: insert spaces in a word

hi again,

of course, i was assuming that you are using the vi editor.

You can also do the same from the command line.

cat oldfile | sed s/\/dev/ \/dev/g> newfile


hope this helps too!

kind regards
yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
Highlighted
Honored Contributor Honored Contributor

Re: insert spaces in a word

Similar answer as the other question you asked:

http://forums11.itrc.hp.com/service/forums/questionanswer.do?threadId=1210912

Where did that string come from, where is it going?
What is the 'real' problem you are trying to solve.

Rather then fixing after the fact exploiting
assumed characteritics which may or might not change, why not solve the core problem and make sure clean data is delivered in the first place?!

For example, witness the following (contrived) example:

$ perl -e 'print join q( ),@ARGV' /dev/*/c0t0d0
$ perl -le 'print @ARGV' /dev/*/c0t0d0
/dev/dsk/c0t0d0/dev/rdsk/c0t0d0
$ perl -le 'print join q( ),@ARGV' /dev/*/c0t0d0
/dev/dsk/c0t0d0 /dev/rdsk/c0t0d0


Hope this helps,
Hein.