you can use command
date | awk '{print $4}'| cut -d ':' -f3
as you mentioned using only the date|awk '{print $4}'
pipeline gives you something like this
20:18:19
so as we can see if we want to extract some part of this string then we need a delimiter , for our case it is :
, so we decide to chop on the basis of :
.
Now this delimiter will chop the string into three parts i.e. 20 ,18 and 19 , as we want the second one we use -f2 in our command.
to sum up ,
cut
: chops some string based on delimeter.
-d
: delimeter (here :
)
-f2
: the chopped off token that we want.