我有一个输出文件目录,我想按顺序显示每个文件的第一行和每个文件的最后十行。
我已经完成了部分命令:
ls output/*Response | sort -t_ --key=2 -g | xargs tail | less
这给了我这样的东西:
==> output/Acdb_18_Response <==
150707,"SOVO","Other","","","","","","160x600",0,0,1432,0,0,1432
167493,"Asper","Other","","","","","","160x600",143200,0,0,1432,0,0
269774,"AIKA","Other","","","","","","160x600",0,1432,0,0,1432,0
342275,"Lorrum","Other","","","","","","160x600",0,0,1432,0,0,1432
347954,"Game","Other","","","","","","160x600",0,1432,0,0,1432,0
418858,"Technologies","Other","","","","","","160x600",0,1432,0,0,1432,0
24576,"Media ","Other","","","","","","300x600",0,0,1432,0,0,1432
23351," Plus","Other","","","","","","425x600",0,4296,0,0,4296,0
#rowcount=79
这很好,但我想包括第一行来获取标题。我尝试将输出端输出到头部,但到目前为止我还无法弄清楚如何安排管道。
有什么建议么?