Skip to main content
1 of 2
jesse_b
  • 41.6k
  • 14
  • 109
  • 163

Not a native way to do it but with sed and readarray:

mapfile -t array < <(echo 'This is some sep.string' | sed $'s/sep./\\\n/g') 

sed will change all occurrences of sep. into a newline which when combined with readarray/mapfile will cause everything between occurrences of sep. to be added to it's own element in array.

jesse_b
  • 41.6k
  • 14
  • 109
  • 163