在字符后获取字符串 [英] Get string after character
本文介绍了在字符后获取字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个看起来像这样的字符串:
I have a string that looks like this:
GenFiltEff=7.092200e-01
使用 bash,我只想获取 =
字符后的数字.有没有办法做到这一点?
Using bash, I would like to just get the number after the =
character. Is there a way to do this?
推荐答案
对于第一个 =
之后和下一个 =
For the text after the first =
and before the next =
cut -d "=" -f2 <<< "$your_str"
或
sed -e 's#.*=()#1#' <<< "$your_str"
对于第一个 =
之后的所有文本,无论是否有多个 =
For all text after the first =
regardless of if there are multiple =
cut -d "=" -f2- <<< "$your_str"
这篇关于在字符后获取字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文