Bash 脚本:提取文件最后 ## 及其后的所有内容
#!/bin/bash/n/n'创建临时文件'/ntemp_file=$(mktemp)/n/n'读取文件内容,并在每行前添加行号'/nnl file.txt > $temp_file/n/n'提取最后一行号'/nlast_line_number=$(tail -1 $temp_file | awk '{print $1}')/n/n'提取从最后一行号开始的所有内容'/nsed -n /'${last_line_number},/$p/' $temp_file/n/n'删除临时文件'/nrm $temp_file/n
原文地址: https://www.cveoy.top/t/topic/lfYg 著作权归作者所有。请勿转载和采集!