[英]How to get combination of Nth line(specific line) and last but one line from text file in Linux?
在一個文件中,我有 100 行。 但我想要文件中的第 17 行和最后一行作為第 99 行。 我需要結合使用命令。
獲取第 17 行:
head -17 file | tail -1
獲取第 99 行:
tail -2 file | head -1
用分號組合命令:
head -17 file | tail -1 ; tail -2 file | head -1
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.