我有一个问题,如何将时间从 12h AM/PM 格式转换为 24h?例如,我有来自标准输入的输入,一些文本是这样的:
The event starts at 03:25PM and is expected to end at 06:17PM.
Registration will be opened from 09:00AM until 06:00 PM.
The event starts at 15:25 and is expected to end at 18:17.
Registration will be opened from 09:00 until 06:00 PM.
如何读取所有 hh:mmPM 和 hh:mmAM 并进行转换?但我不想像这样使用 awk 或 smth。我如何只使用 bash 循环、if/else、echo、sed 等来做到这一点?谢谢!