linux - 如何使用 Bash 读取文件中的倒数第二行?

我有一个文件,最后三行如下。我想检索倒数第二行,即 100.000;8438; 06:46:12.

.
.
.
99.900; 8423;   06:44:41
100.000;8438;   06:46:12
Number of patterns: 8438

我不知道行号。如何使用 shell 脚本检索它?提前感谢您的帮助。

最佳答案

试试这个:

tail -2 yourfile | head -1

https://stackoverflow.com/questions/7022390/

相关文章:

linux - Linux上的二进制grep?

linux - 打印当前一周的星期一的日期(在 bash 中)

linux - 加密/解密在两个不同的 openssl 版本之间不能很好地工作

python - 缺少 python bz2 模块

linux - 顶部的进程命令

python - 错误 : command 'gcc' failed with exit statu

linux - 获取变量中的当前路径并使用它

ruby - 在本地文件夹中安装 gem

python - 如何从命令行下载python?

linux - 如何在 unix 中杀死 tty