开发者

Unix command to copy last line of file to another file

开发者 https://www.devze.com 2023-01-29 04:35 出处:网络
Please provide a command to append an ex开发者_如何学Goisting file by taking a last line of another file.tail -n 1 $file1 >> $file2

Please provide a command to append an ex开发者_如何学Goisting file by taking a last line of another file.


tail -n 1 $file1 >> $file2

Though most systems also support

tail -1 $file1 >> $file2


tail $file1 -n 1 >> $file2

Or,

tail -1 $file1 >> $file2

If you want it to work with sudo:

tail -1 $file1 | tee -a $file2
0

精彩评论

暂无评论...
验证码 换一张
取 消