I have problem with deleting digit only elements from my string/array (conversion is easy) in bash. The trick is, in the array I have elements containing both digits and other character and I want to keep them.
So for
VAR="a2b a22 12b 417 900 600 86400 3600"
The output should be
"a2b a22 12b"
The furthest I could go is:
echo ${VAR}# | sed 's/ [0-9][0-9]*[$ ]/ /g'
but it still doesn't solve the problem. I tried to do it in an array, but without "$" and "^" I'm not able to prevent deletion of some parts of "good elements".
Can anyone help me with that?
sed 's/ [^a-zA-Z][^a-zA-Z]*$//', but for a general solution, see John's answer below.