Re: insert spaces in a word (144 Views)
Reply
Occasional Contributor
Posts: 6
Registered: ‎03-07-2008
Message 1 of 4 (144 Views)

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
Honored Contributor
Posts: 4,613
Registered: ‎11-25-2001
Message 2 of 4 (144 Views)

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
Posts: 4,613
Registered: ‎11-25-2001
Message 3 of 4 (144 Views)

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
Posts: 6,593
Registered: ‎05-19-2003
Message 4 of 4 (144 Views)

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.
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.