我有一个输出文件的目录,我想按顺序显示每个文件的第一行和最后十行。
我已经记下了部分命令:
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
这是很好的,但我想包括第一行,以获得头部。我试图tee'ing输出到头部,但到目前为止,我还没有能够弄清楚如何安排管道。
有什么建议吗?
2条答案
按热度按时间nvbavucw1#
roejwanj2#
您还可以尝试以下操作: