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行
时刻记着自己要成为什么样的人!
例如,查找包含有“hello"关键词的行:
cat file.txt | grep hello #实现查看关键字的所有行 cat file.txt | grep hello head -n 100 #实现查看关键字的前100行 cat file.txt | grep hello | tail -n 100 #实现查看关键字的后100行