I want to edit a file before feeding it into an array. The data file contains:
Line 1 Line 2 Line 3 If I read it with
mapfile -t direct < data I obtain a 3-element direct array
But I pipe the output of a sed command the edited array is empty:
sed s:Line:LINE: data | mapfile -t edited As far as I can tell the sed output is fine (lines with LF separators) and replacing sed with a cat command doesn't improve things anyway.
What am I missing?