grep a time hh:mm:ss

view story

http://stackoverflow.com – i need to split a given date format (hh:mm:ss) like: 10:30:50 in varibles like: hour=10; minute=30 and seconds=50 whit grep in a bash script. I get the time un a variable, for example: time="10:30:50" And I only get the seconds with the follow expression: seconds=echo $time | grep -oE "[^:]+$" Any help to get the minutes and hours? (HowTos)