#!/bin/bash IFS= readarray -d '' arr < <(awk -v RS= -v ORS='\0' '1') echo "Output:" for i in "${!arr[@]}"; do echo "[$i] =>" echo "${arr[i]}" done
Header 1 - Point 1 - Point 2 Header 2 - Point 1 - Point 2 Header 3 -Point 1 - Point 2
Output: [0] => Header 1 - Point 1 - Point 2 [1] => Header 2 - Point 1 - Point 2 [2] => Header 3 -Point 1 - Point 2