当前位置:网站首页>[practical Script] obtain the line number of a file, and then delete the file content.

[practical Script] obtain the line number of a file, and then delete the file content.

2022-06-11 17:57:00 Sighed and sighed

Get the line number of a file , Then delete the file contents .

#!/bin/bash
lines=`wc -l 27754.txt`
newlines=`echo $lines | awk '{print $1}'`
sed -i "1,${newlines}d" 27754.txt
原网站

版权声明
本文为[Sighed and sighed]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/162/202206111742044307.html