vim命令# 删除文件中的负数 %s/-\d\+\.\=\d*//g # 删除含负数的行 g/-\d/d # 删除0,删除0.1 g/^\(-\|[0]\)/d # g/^-d\|0$/d Bash删除文件中小于0的数awk '{ delete a; for (i=1; i<=NF; i++) a[i] = $i; for (i=1; i<=NF; i++) if (a[i] <= 0) { next } } 1' data.txt > new_data.txt