linux过滤文本中含有关键字的行

例如,查找包含有“hello"关键词的行:

cat file.txt | grep hello           #实现查看关键字的所有行

cat file.txt | grep hello head -n 100      #实现查看关键字的前100行

cat file.txt | grep hello | tail -n 100      #实现查看关键字的后100行
原文地址:https://www.cnblogs.com/demo-deng/p/14072280.html