I have my string in $LINE
and I want $ITEMS
to be the array version of this, split on single tabs and retaining blanks. Here's where I'm at now:
IFS=$'\n' ITEMS=($(echo "$LINE" | tr "\t" "\n"))
The issue here is that IFS
is one-or-more so it gobbles up new-lines, tabs, whatever. I've tried a few other things based on other questions posted here but they assume that there will always be a value in all fields, never blank. And the one that seems to hold the key is far beyond me and operating on an entire file (I am just splitting a single string).
My preference here is a pure-BASH solution.