例如:如何仅使用tail和head在第5行和第8行之间打印.text文件的特定行
复制自here
infile.txt包含每行的数值。
infile.txt
➜ X=3 ➜ Y=10 ➜ < infile.txt tail -n +"$X" | head -n "$((Y - X))" 3 4 5 6 7 8 9 ➜