How to Strip White Space, Dash And Colons From Bash

Pipe a timestamp string into sed combined to remove the -, : and white space to get a string which is suitable for a log file

echo -n "10-09-2020 09:00:00" | sed 's/-\|:\|\s//g'

It is very useful for dates or slice strings

Sistem Uzmanı, Linux Hacısı, El-Kernel

Yorum yapın