Operating System - Linux
1748255 Members
4154 Online
108760 Solutions
New Discussion юеВ

Re: insert spaces in a word

 
manasa_1
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 3
Yogeeraj_1
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)
Yogeeraj_1
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)
Hein van den Heuvel
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.