如何使用 sed/grep 提取两个单词之间的文本? [英] How to use sed/grep to extract text between two words?
本文介绍了如何使用 sed/grep 提取两个单词之间的文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图输出一个字符串,其中包含字符串的两个单词之间的所有内容:
I am trying to output a string that contains everything between two words of a string:
输入:
"Here is a String"
输出:
"is a"
使用:
sed -n '/Here/,/String/p'
包括端点,但我不想包括它们.
includes the endpoints, but I don't want to include them.
推荐答案
sed -e 's/Here(.*)String/1/'
这篇关于如何使用 sed/grep 提取两个单词之间的文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文