我有一个ssh
命令,它提供以下输出,我想要修改ssh
命令,以便url
和jirano
输出并排出现如果有jirano
,则第二次更改没有jirano
..我的预期输出低于..可以使用awk
或grep
或{{1}来完成}?
cut
输出
change I739c56305aed3da40132253cf66bce4d315f73 project: platform/vendor/qcom-opensource/data/code branch: bj_5.2 id: I739c56305aed3da40132253cf66bce4d315f73 url: https://review-android.company.com/12345 commitMessage: data: test this is an experiment driver. Since none of the definitions in this file are actually being used today, remove the file and all references to it. jirano: 470101 createdOn: 2013-04-18 13:17:05 PDT lastUpdated: 2013-04-18 17:21:54 PDT change I739c56305aed3da401a5323cf66bce4d315f73 project: platform/vendor/qcom-opensource/data/code branch: bj_5.2 id: I739c56305aed3da401a532253cf66bce4d315f73 url: https://review-android.company.com/67899 commitMessage: test1 this is an test donot experiment used today, createdOn: 2013-04-18 13:17:05 PDT lastUpdated: 2013-04-18 17:21:54 PDT
预期输出
https://review-android.company.com/12345 470101 https://review-android.company.com/67899
答案 0 :(得分:1)
$ awk '/url|jirano/{print $2}' foo.txt | sed 'N; y/\n/ /'
结果
https://review-android.company.com/12345 470101
https://review-android.company.com/67899