从字符串中获取子字符串的最后一个索引之后的字符

从字符串中获取子字符串的最后一个索引之后的字符

问题描述:

我有一个字符串,它是另一个命令的输出.我只需要显示此字符串的结尾即可.分隔符字符串是"."(点和空格),我需要在最后一个索引"."之后的字符串.

I have a string which is an output of another command. I only need the end of this string to display. The separator string is "." (dot and space), and I need the string after the last index of ".".

如何在Bash中做到这一点?

How can I do this in Bash?

尝试一下:

your cmd...|sed 's/.*\. //'

无论输入内容中有多少个点"或点和空格",此方法都有效.它需要在最后个点和空格"

this works no matter how many "dot" or "dot and space" do you have in your input. it takes the string after the last "dot and space"