我有一个有趣的项目要做!我正在考虑将 srt 文件转换为 csv/xls 文件。
srt 文件如下所示:
1
00:00:00,104 --> 00:00:02,669
Hi, I'm shell-scripting.
2
00:00:02,982 --> 00:00:04,965
I'm not sure if it would work,
but I'll try it!
3
00:00:05,085 --> 00:00:07,321
There must be a way to do it!
虽然我想将它输出到这样的 csv 文件中:
"1","00:00:00,104","00:00:02,669","Hi, I'm shell-scripting."
"2","00:00:02,982","00:00:04,965","I'm not sure if it would work"
,,,"but I'll try it!"
"3","00:00:05,085","00:00:07,321","There must be a way to do it!"
如您所见,每个字幕占用两行。我的想法是使用 grep 将 srt 数据放入 xls,然后使用 awk 格式化 xls 文件。
你们有什么感想?我想怎么写?我试过了
$grep filename.srt > filename.xls
似乎包括时间码和字幕字在内的所有数据最终都在 xls 文件的 A 列中......但我希望这些词在 B 列中...... awk 如何帮助格式化?
先感谢您!:)