Manipulating data in variable

Hi,

I have two variables - A and B - containing a bunch of file paths. I am comparing them and when I find a match I want to remove that entry from A so that as the compare proceeds A shrinks entry by entry.

How can I remove a matched entry from A whilst leaving the non matched entries intact?

Any ideas would be most welcome - apologies if this is dead easy - I am back in scripting after a *very* long time out..........

A sample value of A (or B for that matter) would help....

mA="3 2 4 5 7 9 33 66"
mB="3 6 7 8 9 0 22"
mAOut=${mA}
for mEach in ${mB}
do
   mAOut=`echo ${mAOut} | sed "s/\<${mEach}\>/ /"`
done
echo "mAOut = "${mAOut}

Apologies. The sort off thing suggested by Shell Life is pretty much representative of the sort of thing I am trying to.
Thanks Shell Life - this looks like what I am after. Will give it a whirl.

Looking at this I don't think I have explained myself at all well.

var A contains - essentially - a list of paths to files in a particular dir
var B contains the same but it is a different dir. As the script runs Var A will not be regenerated but with every iteration of a loop var B will.

These two sets of paths *should* be the same. I am looking for matches and if one occurs I want to blank out the var A entry so that it becomes smaller over the course of the script run so as to cut down on the number of entries that have to be considered in subsequent iterations of the loop.

So I want to preserve var A but be able to reduce it in size as the script proceeds.

I hope this is clearer

Ajcannon,
This is exactly what the shell is doing.

Did you run the script?

I saved the value of 'mA' into 'mAOut' and every iteration of the shell,
the variable 'mAOut' is being reduced.

Place an 'echo ${mAOut}' inside of the loop to watch what is happening.

Shell Life

my mistake - I did not run it - I looked at it and did not appreciate it *did* do what I wanted.

All is now well - thanks again