You are viewing a single comment's thread. Return to all comments →
readarray -t array echo "${array[@]/*[aA]*/}" | xargs
another approach: readarray -t array printf '%s\n' "${array[@]}" | grep -Ev "a|A"
readarray -t array printf '%s\n' "${array[@]}" | grep -Ev "a|A"
here printf prints each array element in a new line, The grep command here filters out 'a' or 'A'
Seems like cookies are disabled on this browser, please enable them to open this website
Filter an Array with Patterns
You are viewing a single comment's thread. Return to all comments →
readarray -t array echo "${array[@]/*[aA]*/}" | xargs
another approach:
readarray -t array printf '%s\n' "${array[@]}" | grep -Ev "a|A"
here printf prints each array element in a new line, The grep command here filters out 'a' or 'A'