首页 > 编程知识 正文

正则截取中间字符串,字符串替换算法

时间:2023-05-04 20:12:25 阅读:24283 作者:4069

#! /bin/bash

# gitfetchssh ://Baidu.net @ Gerrit.Baidu.net 336029418/weixin refs/changes/72/16272/14 git cherry-pick fee

# gitfetchssh ://Jenkins @ Gerrit.Baidu.net 336029418/weixin refs/changes/72/16272/14

#git cherry-pick FETCH_HEAD -n

#1.替换Baidu.net

#2.删除后面的字符串

#过渡字符kwdsc

cherry pick=' gitfetchssh ://Baidu.net @ Gerrit.Baidu.net 336029418/weixin refs/changes/72/16272/14 gitchhh

echo ' org instr : [ $ { cherry pick } ]

echo 'Substr: ${substr} '

rep=$ (echo $ substr|sed ' s/ssh : (/(/. * @ Gerrit/ssh : (/(/Jenkins @ Gerrit/' ) ) )。

echo 'Replace Str: ${rep} '

echo 'CherryPick Start

echo 'Will exec : [${rep}] '

echo 'CherryPick Start

#一句

command=$ (echo $ { cherry pick % * }|sed ' s/ssh : (/(/. * @ Gerrit/ssh 3360 )/(/Jenkins @ Gerrit/'

echo ' cherry拾取开始命令

echo 'Will exec : [${command}]

echo ' cherry拾取开始命令

shell脚本的sed是----替换、变量、转义字符https://blog.csdn.net/wangcg 123/article/details/50667883? utm_source=blogxgwz0

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。