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.
例如:如何仅使用尾部和头部打印 .txt 文件的第 5 行和第 8 行之间的特定行
从这里复制
infile.txt每行包含一个数值。
infile.txt
➜ X=3 ➜ Y=10 ➜ < infile.txt tail -n +"$X" | head -n "$((Y - X))" 3 4 5 6 7 8 9 ➜