【发布时间】:2014-02-03 17:09:08
【问题描述】:
[ec2-user@domU-11-21-89-34-70-33 bin]$ ./elastic-beanstalk-describe-applications
ApplicationName | ConfigurationTemplates | DateCreated | DateUpdated | Description | Versions
---------------------------------------------------------------------------------------------
cc | | Mon Dec 09 00:18:03 +0000 2013 | Mon Dec 09 00:18:03 +0000 2013 | N/A | git-12301561af82aa81a15e7392e7052b6541a384f6d-1391446824430, git-0f63961a916b08fdfed3ec4c9491037029050f78-1391444770972, git-0e43769a916b08fdfed3ec4c9491037029050f78-1391444302590 ...
我需要从第一个 "git-12301561af82aa81a15e7392e7052b6541a384f6d-1391446824430" 中提取 "12301561af82aa81a15e7292e7052b6541a384f6d" 最好的方法是什么?
而且字符串可能很长,... 是不同 git shas 的重复模式。
【问题讨论】:
-
cut擅长这种事情(在有人建议使用 awk 脚本之前)。