KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm trying to extract the time from a string using bash, and I'm having a hard time figuring it out. My string is like this: US/Central - 10:26 PM (CST) And I want to extract the 10:26 part. Anybody knows of a way of doing this only with bash - without using sed, awk, etc? Like, in PHP I would use - not the best way, but it works - something like: preg_match( ""(\d{2}\:\d{2}) PM \(CST\)"", "US/Central - 10:26 PM (CST)", $matches ); Thanks for any help, even if the answer uses sed or awk
Tags (comma-separated)
Save Edits
Cancel