$cat process-file.csv
"key1","key1-ConnString","Server=database.windows.net,1433;Database=sqldb;Persist Security Info=False;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;"
process-file.sh
#!/bin/bash
strip_quotes() {
echo `sed -e 's/^"//' -e 's/"$//' <<<"$1"`
}
while IFS=, read -r key1 keyC secretValue; do
echo "$(strip_quotes $secretValue)"
done < process-file.csv
$ ./process-file.sh
Server=database.windows.net,1433;Database=sqldb;Persist
How to preserve spaces in a string that needs the quote removed?