If you only have one record per file then this is a simple read loop.
#!/bin/bash
read_data()
{
local first last addr city state zip
file=$1
while read -r header data
do
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
esac
done < $file
echo "$file,$first,$last,$addr,$city,$state,$zip"
}
for file in *srcfiles*
do
read_data $file
done
The 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 for loop.
Note some potential gotcha's: If there are commas in the data then this will break things, so you might want to do
echo "\"$file\",\"$first\",\"$last\",\"$addr\",\"$city\",\"$state\",\"$zip\""
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.
Adjust the echo line to match the format you want.