To start with, I have been reading this site for years, Unfortunately I do not consider myself versed well enough with scripts to provide useful help to others. The Blind cannot lead the Blind!
Many of you have provided me with brain food and solutions over the years without even knowing it and for that... I thank you, for doing what you do!
Now my question is ...
WHY does the following work, It Prepends a valid ITEMCOUNT to each lineitem, yet
Not sure about the quote issue, but I do understand the messy formatting. You could put a dash "-" in the start of the here document like this:
done <<-EOF
This allows for better formatting although I think the final EOF still needs to be at the beginning of the line. I suspect you're using since it is behaving like this. More info can be found in Chapter 10 of Expert Shell Scripting (Apress).