Hi Friends,
I have following string.
1:Y 2:Y 3:Y 4:Y 5:Y 6:N 7:N 8:Y 9:N 10:N 11:N 12:N 13:Y 14:Y 15:411
I need to have follwoing string.
'Y','Y','Y','Y','Y','N','N','Y','N','N','N','N','Y','Y','411'
Thank you,
Prashant
Hi Friends,
I have following string.
1:Y 2:Y 3:Y 4:Y 5:Y 6:N 7:N 8:Y 9:N 10:N 11:N 12:N 13:Y 14:Y 15:411
I need to have follwoing string.
'Y','Y','Y','Y','Y','N','N','Y','N','N','N','N','Y','Y','411'
Thank you,
Prashant
xx='1:Y 2:Y 3:Y 4:Y 5:Y 6:N 7:N 8:Y 9:N 10:N 11:N 12:N 13:Y 14:Y 15:411'
echo $xx\' | sed "s/[[:digit:]]\+:/'/g; s/ /',/g"
Thank you so much.
Some implementations of sed don't seem to like that (eg mine )
I fiddled it a teeny bit to get:
echo $string | sed "s/[0-9]*\:/\'/g; s/ /\',/g;s/$/\'/"
(Also added the s/$/\'/ bit to avoid having to tack a ' on the end of the line manually)