Using any POSIX awk
$ awk -v RS= -F'[[:space:]]*,[[:space:]]*' -v OFS=',' '{$1=$1}1' file
BCTS1,07/09/2021,09:06:26,09:09:26,0 horas con 3 minutos
and if you don't have a POSIX awk (for the [:space:]
character class) then:
$ awk -v RS= -F'[ \t\n]*,[ \t\n]*' -v OFS=',' '{$1=$1}1' file
BCTS1,07/09/2021,09:06:26,09:09:26,0 horas con 3 minutos
The above assumes that, like in the example you posted, you don't have any blank lines in the input. If you do then you could use this with GNU awk (for multi-char RS and \s
shorthand):
$ awk -v RS='^$' -v ORS= -F'\\s*,\\s*' -v OFS=',' '{$1=$1}1' file
BCTS1,07/09/2021,09:06:26,09:09:26,0 horas con 3 minutos
or this with any awk:
$ awk '{r=r $0 OFS} END{$0=r; gsub(/[ \t]*,[ \t]*/,","); print}' file
BCTS1,07/09/2021,09:06:26,09:09:26,0 horas con 3 minutos