Unix命令将文件的最后一行复制到另一个文件

发布于 2024-10-06 00:54:17 字数 37 浏览 0 评论 0原文

请提供一个命令,通过获取另一个文件的最后一行来附加现有文件。

Please provide a command to append an existing file by taking a last line of another file.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

睫毛溺水了 2024-10-13 00:54:17
tail -n 1 $file1 >> $file2

虽然大多数系统也支持

tail -1 $file1 >> $file2
tail -n 1 $file1 >> $file2

Though most systems also support

tail -1 $file1 >> $file2
寄离 2024-10-13 00:54:17
tail $file1 -n 1 >> $file2

或者,

tail -1 $file1 >> $file2

如果您希望它与 sudo 一起使用:

tail -1 $file1 | tee -a $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
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文