Extracting a word from a variable

Hi Guys,

Need you quick assistance on the below, trying to extract a word from a variable

i.e. acmi101[space]acmi102[space]acmi103[space]acmi104

When i use the following code awk '{gsub(/cmi102/,"")};1' it leaves a space in the variable, need to get rid of the space that it leaves. Any ideas.

the above result, would be

acmi101[space][space]acmi103[space]acmi104

need it to be

acmi101[space]acmi103[space]acmi104

need to get rid of the extra space.

gsub(/cmi102  */,"")

Fanstastic.......now why didnt I think of that. Many Thanks radoulov

---------- Post updated at 11:58 AM ---------- Previous update was at 11:32 AM ----------

radoulov,

The gsub(/cmi102 */,"") does not get rid of the acmi102, just removes the cmi102, but the "a" is still present, tried using the below to no avail...any help?

gsub(/+cmi102 */,"")

---------- Post updated at 12:00 PM ---------- Previous update was at 11:58 AM ----------

also note, that the "a" could be a many letters, so I could not used gsub(/acmi102 */,"") , as I might be searching for axfbcmi102....etc....

gsub(/[^ ]*cmi102 */,"")