从命令行设置 Amazon EC2 实例列表的格式
我使用 ec2-describe-instances -H
检索有关当前 Amazon EC2 实例的数据,它返回如下内容:
Type ReservationID Owner Groups Platform
RESERVATION r-xxxxxxxx xxxxxxxxxxxx default
INSTANCE i-xxxxxxxx ami-2b5fba42 ec2-xx-xx-xx-xx.compute-1.amazonaws.com ip-xx-xx-xx-xx.ec2.internal running user 0 m1.small 2011-07-12T21:15:39+0000 us-east-1a aki-xxxxxxxx ari-xxxxxxxx monitoring-disabled xx.xx.xx.xx xx.xx.xx.xx instance-store paravirtual xen sg-xxxxxxxx default
这在 OS X 终端中看起来很混乱。我怎样才能使这个输出更具可读性?
I retrieve data about my current Amazon EC2 instances with ec2-describe-instances -H
, which returns something like the following:
Type ReservationID Owner Groups Platform
RESERVATION r-xxxxxxxx xxxxxxxxxxxx default
INSTANCE i-xxxxxxxx ami-2b5fba42 ec2-xx-xx-xx-xx.compute-1.amazonaws.com ip-xx-xx-xx-xx.ec2.internal running user 0 m1.small 2011-07-12T21:15:39+0000 us-east-1a aki-xxxxxxxx ari-xxxxxxxx monitoring-disabled xx.xx.xx.xx xx.xx.xx.xx instance-store paravirtual xen sg-xxxxxxxx default
This looks messy in the OS X terminal. How can I make this output more readable?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我刚刚编写了一些您可能感兴趣的 bash/awk 脚本:
https://github.com/epheph/fec2din
它以以下格式显示 EC2 实例输出:
I just whipped up a little bash/awk script you might be interested in:
https://github.com/epheph/fec2din
It displays EC2 instance output in the format of:
您想看到或查看哪些具体部分?
这将为您提供实例名称,在您的示例中为
ec2-xx-xx-xx-xx.compute-1.amazonaws.com
。编辑
正如提出问题的人所说,他们希望以更干净的格式......没有具体说明那是什么......这是我微弱的尝试:
小免责声明上面的代码可能并不完美......它是为了向提出问题的人提供正确的信息,以制作他们认为合适的“干净格式”。
What specific portions would you like to see, or view?
This will give you the instance name, which would be
ec2-xx-xx-xx-xx.compute-1.amazonaws.com
in your example.Edit
As the person asking the question said they wanted it in a cleaner format ... without specifying what that is ... here is my feeble attempt:
small disclaimer the above code may not be perfect ... it's to give the person asking the question the right information to make a "clean format" however they see fit.