线==&QUOT后删除文件的内容; XXXXXXX" [英] Delete file contents after line == "xxxxxxx"

查看:127
本文介绍了线==&QUOT后删除文件的内容; XXXXXXX"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一堆我需要清理的文件。我需要删除线等于什么(该行也应该被删除)。

I have a bunch of files I need to clean. I need to delete all lines below a line that is equal to something (that line should be removed too).

如何能做到这一点在bash?

How can I do that in bash?

我只需要怎样删除线的例子,我可以循环所有的文件我自己。

I just need the example of how to delete the lines, I can loop all the files myself.

推荐答案

简单的方法就是告诉SED当它看到其退出。

Easiest to just tell sed to quit when it sees it.

sed -n '/xxxxxxx/q;p' input.txt

这篇关于线==&QUOT后删除文件的内容; XXXXXXX"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆