[英]Compare the first column and then combine two text files in linux with bash script?
[英]Compare two files in Linux: ignoring first and last lines
使用GNU tail
和head
:
要忽略文件的前10行,請使用如下所示的tail
:
tail -n +11 file
要忽略文件的最后3行,請像這樣使用head
:
head -n -4 file
然后,您可以使用進程替換構造diff
命令,如下所示:
diff <(tail -n +11 file | head -n -4) <(tail -n +11 file2 | head -n -4)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.