Artificial intelligent assistant

emulate tail with sed I have a mini-system with only limited number of binaries (`bash`,`cp`,`cat`,`sed`, ...). I don't have `tail` command, and I am wondering if I could emulate tail functionality with `sed` cat foo.txt | tail -n 10 I know that I can print lines 1-10 with sed `cat foo.txt | sed -n '1,10p'`, but how would I print the last 10 lines?

You could do something like this:


sed -e :a -e '$q;N;11,$D;ba'

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy a8f2db1bfbc560eaf387ee2c82cd1bb4