Is there a way without perl? Ya, I could use it - however, I hate mixing languages like that. Is there a way (function of some sort, etc) that I could do this in bash?
Main Topics
Browse All TopicsIs there any one liner to convert hh:mm:ss to seconds. In other words 01:20:50 (1:20 AM and 50 seconds) to just seconds?
It seems really simple - however, I don't think the date command would work. I don't want seconds from original Unix time - I actually want to know how many seconds are in 01:20:50. This is obviously a sample time and will be different at any given time - so that's why I need a way to do this. This would be a bash one-liner or sample code of the like. I can implement into my script, so no need to create a whole base script for me (snippets welcomed).
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Business Accounts
Answer for Membership
by: nemws1Posted on 2009-09-14 at 13:49:40ID: 25329209
How about a quick one-liner in perl?
Select allOpen in new window