sed or awk

Hi ...

My script contains a variable which is genrated and passed in... however the variable contains two white spaces; it should be only 1

So its X Y it should be X Y ....

tried cat $var sed $1//\// > $newvar

thanking you all inadvance...

If I got it - you want to remove a trailing space from a variable: $1.
One way, no awk or sed, just shell:

var="$1"
var=${var%% }

Hi Jim,

Thanks for taking time to reply. I don't think I made myself clear enough, apologies;

basically the variable is X<space><space>Y, but I need to make the variable X<space>Y

Thanking you all inadvance..

One of the many ways is...

str=$(echo $str | tr -s " ")