Hello

I have the following in a variable called TEST

echo $TEST
result : STEPHEN LTD

What i want to do is find out whether there are any spaces in my variable name, and if so do the following

STEPHEN%42LTD

bascially put a %42 where the space is....any ideas?

sed 's/ /%42/g'

Thanks for the response....sorry i wasnt clear.

I have spaces .... lets say 3, maybe 4

But i want to put different things within in the spaces. So the above would put %42 in every space

well, you've got the way to go, do read the manpages for sed.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.