Trying to retrieve first 5 characters (only number & alphabet) from string in bash

Viewed 116

I have a string like that

1-a-bc-dxyz

I'd want to get 1-a-bc-d ( first 5 characters, only number and alphabet)

Thanks

6 Answers
Related