首页 > 解决方案 > 如何删除从我想要的单词开始的单词,直到找到模式(即使它在接下来的几行中)?

问题描述

考虑这个例子。

Twinkle Twinkle Little Star
How I wonder what you are
up above the world so high, 
like a diamond in the sky.....

我想从(第二行)中删除五个点(第四行)?

如何在 shell 脚本中执行此操作?

另一个例子:

The itsy bitsy spider crawled up the water spout.
Down came the rain, and washed the spider out.
Out came the sun, and dried up all the rain,
and the itsy bitsy spider went up the spout again

我想删除从(在第二行)到逗号字符(在雨后的第三行,不是第二行中的逗号,也不是靠近单词 sun 的那个)。

标签: shellawksed

解决方案


推荐阅读