摘要: sed命令常用到的两个选项:-i : 直接在文件上编辑 (edit files in place)-e[默认选项]:只在命令行输出,而文件不改变(add the script to the commands to be executed)注:使用sed命令可以使用 -i 或者 -e 选项(以下例子仅 阅读全文
posted @ 2019-08-14 11:13 Poke 阅读(37082) 评论(0) 推荐(0) 编辑
摘要: 有时候因为要一行行地读文件,所以需要先知道该文件中最长的行的大小。 下面的两个命令就是得到一个文件中的最长行和最短行 最短行:awk '(NR==1||length(min)>length()){min=$0}END{print min}' data.txt 最长行:awk '{if (length 阅读全文
posted @ 2019-08-14 11:09 Poke 阅读(688) 评论(0) 推荐(0) 编辑