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.
假设我有一个包含任意行数的文件,例如 125。我想获取除第一个 n 之外的所有行,例如 20。所以,我想要第 21-125 行。
有没有办法用tail/head或其他工具来做到这一点?
tail
head
尝试
tail -n +21 myfile.txt
sed -i 1,20d filename
如果你想删除前 20 行!
也可以使用 awk 电源:
awk -- 'NR > 20' /etc/passwd
我对此感到生疏,但类似于:tail -n +20 文件名