Implement tail with awk

后端 未结 4 1601
失恋的感觉
失恋的感觉 2021-01-19 16:44

Alright so here i am struggling with this awk code wich should emulate the tail command

num=$1;
{
    vect[NR]=$0;

}
END{
    for(i=NR-num;i<=NR;i++)
            


        
4条回答
  •  误落风尘
    2021-01-19 17:20

    This might work for you:

    awk '{a=a b $0;b=RS;if(NR<=v)next;a=substr(a,index(a,RS)+1)}END{print a}' v=10
    

提交回复
热议问题