shell - 如何删除从我想要的单词开始的单词,直到找到模式(即使它在接下来的几行中)?
问题描述
考虑这个例子。
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 的那个)。
解决方案
推荐阅读
- sdk - 谷歌云使用 Cloud SDK shell 将 Python 程序作为 localhost 服务器运行
- node.js - 如何在 fastify 注入上使用 node-tap 模拟函数
- windows - 在 Windows 脚本中运行 ffmpeg 以缩小 MP3 文件时删除错误
- python - 从文件读取标题时出错 - 请求
- javascript - 未能调用角度函数
- c++ - C++ - 如何将两个链表相减?
- javascript - Hummus-recipe NPM:TypeError:无法开始解析 PDF 文件
- azure - Azure 容器实例安全 VPN
- node.js - 在 Express 服务器上将 Socket.io 切换到 WebSocket 通信时出错
- laravel - 通过 Passport Laravel 在 Adonis JS 中使用生成的令牌