Ansible |提取线的一部分

时间:2019-03-06 07:24:24

标签: ansible line extract

我要提取一行的一部分。

例如行:-Dlogging.configuration=file:/ngs/app/dsservt/TEST/DS/IdmsCoreServiceClassic/13443/runtime/jboss/standalone/configuration/logging.properties -jar /ngs/app/dsservt/TEST/DS/IdmsCoreServiceClassic/13443/runtime/jboss/jboss-modules.jar -mp /ngs/app/dsservt/TEST/DS/IdmsCoreServiceClassic/13443/runtime/jboss/modules org.jboss.as.standalone -Djboss.home.dir=/ngs/app/dsservt/TEST/DS/IdmsCoreServiceClassic/13443/runtime/jboss -Djboss.server.base.dir=/ngs/app/dsservt/TEST/DS/IdmsCoreServiceClassic/13443/runtime/jboss/standalone

期望提取的输出:

/ngs/app/dsservt/TEST/DS/IdmsCoreServiceClassic/13443/runtime/

我不确定如何实现这一目标。

请帮助我。

1 个答案:

答案 0 :(得分:0)

使用正则表达式

\/ngs.........................................................\/

https://regex101.com/