If you only have one record per file then this is a simple read loop.
local first last addr city state zip
while read -r header data
case $header in
FirstName:) first=$data ;;
LastName:) last=$data ;;
Address:) addr=$data ;;
City:) city=$data ;;
State:) state=$data ;;
Zip:) zip=$data ;;
*) echo Ignoring bad line $header $data >&2
done < $file
for file in *srcfiles*
read_data function reads each line and splits up the line into a "header" and a "data". Once we get to the end of the file we just print out the results.
We call that function once for each source file via the
Note some potential gotcha's: If there are commas in the data then this will break things, so you might want to do
as the output to enclose everything inside
"..." layout. If there's any
" in the data then this may cause the CSV to be malformed as well.
echo line to match the format you want.