头上有什么相反的?(What's the opposite of head? I want all but the first N lines of a file)
给定一个长度不明的文本文件,我如何读取,例如文件的前2行呢? 我知道tail会给我最后的N行,但我不知道N是提前的。
所以对于一个文件
AAAA BBBB CCCC DDDD EEEE我想要
CCCC DDDD EEEE和一个文件
AAAA BBBB CCCC我会得到的
CCCCGiven a text file of unknown length, how can I read, for example all but the first 2 lines of the file? I know tail will give me the last N lines, but I don't know what N is ahead of time.
So for a file
AAAA BBBB CCCC DDDD EEEEI want
CCCC DDDD EEEEAnd for a file
AAAA BBBB CCCCI'd get just
CCCC最满意答案
tail --help如下:
-n, --lines=K output the last K lines, instead of the last 10; or use -n +K to output lines starting with the Kth所以要过滤掉前2行, -n +3应该给你你要查找的输出(从3开始)。
tail --help gives the following:
-n, --lines=K output the last K lines, instead of the last 10; or use -n +K to output lines starting with the KthSo to filter out the first 2 lines, -n +3 should give you the output you are looking for (start from 3rd).
更多推荐
发布评论