It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center




7年前关闭。




如果我的文件包含100,000行,如何打印指定范围内的行,例如15010至15020行?

最佳答案

sed:

$ sed -n '15010,15020p' input.txt
awk:
$ awk '15010<=NR && NR <=15020' input.txt
head/tail:
$ head -n 15020 input.txt | tail -n $((15020-15010+1))

07-26 08:09