[英]extract text from Jenkins console output and store it into a csv file using sed in linux
我的 Jenkins 控制台輸出了類似的文本行:
NumberOfTestCases of tier1 in https://****:****@bess-bitbucket.bearingpoint.com/scm/bnktst/stat-autopilot-testcases.git are 4
我想將以下內容提取到 3 列中:
層 | 網址 | 測試用例數 |
---|---|---|
第一層 | https:// : @bess-bitbucket.bearingpoint.com/scm/bnktst/stat-autopilot-testcases.git | 4 |
我有以下代碼,它只提取 URl 和 NumberofTestCases。 我想將第一列的值也包含在我的 SED 命令中。
wget ${BUILD_URL}/consoleText -O ${WORKSPACE}/SomeFile.txt
sed -n 's/.*\(https.*git\)\ are\ \([[:digit:]]\{1,\}\)/\1,\2/p' SomeFilex.Txt
使用sed
$ sed -En '/NumberOfTestCases/s/[^ ]* ([^ ]* ){2}([^ ]*) [^ ]* ([^ ]*).*([0-9]+)/\2\t\3\t\4/p;1i TIER\tURL\tNumberOfTestCases' somefile.txt
TIER URL NumberOfTestCases
tier1 https://****:****@bess-bitbucket.bearingpoint.com/scm/bnktst/stat-autopilot-testcases.git 4
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.