I want to remove all the whitespaces from the ouptut of $date by using $awk but somehow it does not work as intended, what am I missing here?
date | awk '{gsub(/ *\| */,",")}1'
Sat 28 Mar 23:13:22 CET 2020
I want to remove all the whitespaces from the ouptut of $date by using $awk but somehow it does not work as intended, what am I missing here?
date | awk '{gsub(/ *\| */,",")}1'
Sat 28 Mar 23:13:22 CET 2020
Solution with the underscore set as the separator:
date | awk '{gsub(/ /,"_")}1'
Workaround without awk(no separator):
date | tr -d '[:space:]'