Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
所以我知道要在文件中找到第一次出现模式的行号:
zgrep -n -m 1 "pattern" big_file.txt.gz
但是如果我想跳过前 500K 行怎么办?(我无法解压缩文件。它太大了。)
你可以使用这个gzcat | awk命令:
gzcat | awk
gzcat big_file.txt.gz | awk 'NR > 500000 && /pattern/ {print NR ":" $0; exit}'