A txt-File shall be analyzed: It has many lines each having 20 fields separated by TABs and each field can contain any type of data (Integer, FloatingPoint, DateTime, text also conatining BLANKS and "" etc.) and in addition to that fields can be empty, e.g. such a line would start like
111TABTABWalterTAB11.1234TABThis is a sample TextTAB"Another sample"TABTABTAB555...
How can I read each line of the file into an array arrLine having 20 columns, e.g.
- arrLine(0)=111
- arrLine(1)=empty
- arrLine(2)=Walter
- ...
I tried this proposal like
while IFS=$'\t' read -r -a arrLine; do
echo "${#arrLine[@]} items: ${arrLine[@]}"
echo "${arrLine[3]} || ${arrLine[4]} || ${arrLine[5]}"
done < "test.txt"
but empty colums are not filled into the array.
Thank you!