我有两个问题
发布于 2010-10-20 07:27:10
对于grep,-C是直接前进的选项。
关于第二个问题,试试这个!
sed -n "100000,20000p" bar.txt > foo.txt 发布于 2010-10-20 07:15:30
您需要查看grep的-A -B和-C选项。有关更多信息,请参见man grep
-A NUM, --after-context=NUM
Print NUM lines of trailing context after matching lines.
Places a line containing -- between contiguous groups of
matches.
-B NUM, --before-context=NUM
Print NUM lines of leading context before matching lines.
Places a line containing -- between contiguous groups of
matches.
-C NUM, --context=NUM
Print NUM lines of output context. Places a line containing --
between contiguous groups of matches.要重定向输出,请执行以下操作:grep "your pattern" yourinputfile > /tmp/testout
发布于 2010-10-20 07:13:09
参见head和/或tail。
例如:
head -n 20000 <input> | tail -n 10000 > /tmp/testout而尾部的论点是(20000 - 10000)。
https://stackoverflow.com/questions/3975478
复制相似问题