linux - Grep 使用帮助

标签 linux grep header

我想使用 grep 查找语料库中的所有标题,我想找到直到 : 的所有内容,然后忽略所有内容。有谁知道这是怎么做到的吗? (能不能给我完整的一行代码)

最佳答案

使用 sed 或 awk。

一个 sed 例子:

sed -e '/^[^:]*$/d' -e 's/\(.*\):.*/\1/' filename

关于linux - Grep 使用帮助,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1074391/

相关文章:

linux - Grep 从文件末尾开始

c - 在c中实现http授权头

PHP生成文件以供下载然后重定向

android - 用于 linux 平台的中间件 android 开发的模拟器

linux - 如何使用 'hrtimer'的函数?

linux - Linux 的 Perl 脚本中的权限错误

regex - 抓取 '../'(点斜线)

bash - 带有 if 语句的 Grep 命令

c - 在一定时间内运行循环的最佳方法

html - 网页标题破坏问题