Here is my code:
readarray -d '' sumarray < <(find . -iname '*.sum' -print0 | sort -z)
readarray -d '' maparray < <(find . -iname '*.edit2' -print0 | sort -z)
for ((i = 0; i < ${maparray[#]}; i++)); do
paste <(cut -d , -f 3 -s "${sumarray[$i]}") <(cut -f 2 -s "${maparray[$i]}") > "${sumarray[$i]/.csv/.merged.csv}"
done
I have TSV and CSV files, in pairs where their filenames share the same ID's in them. I am combining specific columns from each of those files to make a new CSV file. I have put the files into a sorted array. I have a for loop to create a new CSV file for every pair.
The error I am getting is:
syntax error: operand expected (error token is "#")
I am also running bash version 4.4 so readarray -d defintely works.
I have also tested the paste command and it works fine.
I think the error is in the for
line, but I am not sure what