1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
#!/bin/bash echo 'This is used to delete the space begin and end of the line' if test $# -ne 1; then echo 1>&2 "Usage $0 file" exit 1 fi set -x sed -i 's/^ *//g' $1 sed -i 's/ *$//g' $1 sed -i 's/[ ][ ]*/ /g' $1 |
去除行首行尾多余的空格,把中间数量不等的空格替换为一个。主要用来处理uniq -c的输出文件。