How to extract a substring matching a pattern from a Unix shell variable How to extract a substring matching a pattern from a Unix shell variable shell shell