如何从python子进程的输出中awk特定字段。

问题描述 投票:0回答:1
  Tablespace name                          = SYSCATSPACE

  Tablespace ID                            = 0

  Tablespace Type                          = Database managed space

  Tablespace Content Type                  = All permanent data. Regular table space.

  Tablespace Page size (bytes)             = 16384

  Tablespace Extent size (pages)           = 4

  Automatic Prefetch size enabled          = Yes

  Buffer pool ID currently in use          = 1

  Buffer pool ID next startup              = 1

  Using automatic storage                  = Yes

  Auto-resize enabled                      = Yes

如何选择 tablespace name 如果 auto resize 标签设置为 yes? (我需要这样做x量显示附加信息的表空间)。

python-3.x db2-luw
1个回答
1
投票

你用什么db2命令来获得这个输出?

与其试图解析输出,不如从db2目录系统表中选择表空间,然后根据你的需要过滤你的行。

SELECT MEMBER, TBSP_ID, TBSP_NAME FROM TABLE(MON_GET_TABLESPACE('',-2)) AS t  
   WHERE  TBSP_AUTO_RESIZE_ENABLED = 1 

更容易。

PS.我不知道你说的是什么意思。 我不知道你的意思是通过做一个 "拟态 python没有什么神奇的方法,它必须向DB2索取信息。 我给你最好的方法来检索你想要的信息,从db2的角度......不管使用的是什么语言。

© www.soinside.com 2019 - 2024. All rights reserved.