I am trying to produce a .csv file in a Bash shell script. Please consider this code:
#!/bin/bash
for f1 in *_8_kHz.wav
do
for f2 in *_8_kHz.wav
do
# echo "pesq +8000 $f1 $f2"
echo -n `pesq +8000 $f1 $f2 | grep Prediction | rev | cut -b1-5 | rev`
done
echo
done
This works except, of course, that each line ends with a comma. Here is sample output:
4.500,1.029,1.651,1.475,1.698,1.706,
1.550,4.500,1.477,1.148,1.788,1.478,
1.251,0.958,4.500,1.472,2.091,1.800,
0.961,1.154,1.550,4.500,1.702,1.501,
1.194,0.974,1.356,1.206,4.500,1.626,
0.857,0.960,1.091,1.064,2.012,4.500,
What is the most efficient way to omit those trailing commas?