去掉txt文本文件中的空行和重复的行:
#!/bin/bash -
#===============================================================================
#
# FILE: 1.sh
#
# USAGE: ./1.sh
#
# DESCRIPTION:
#
# OPTIONS: ---
# REQUIREMENTS: ---
# BUGS: ---
# NOTES: ---
# AUTHOR: Karl Zheng (), ZhengKarl#gmail.com
# CREATED: 2012年10月28日 14时26分25秒 CST
# REVISION: ---
#===============================================================================
set -o nounset # Treat unset variables as an error
vim -c ':%s#\s*$##g' -c ':%s#\r\n#\r#g' -c ':g#^\s*$#d' -c ':wq' "$1"
for f in *.txt;do ./1.sh "$f";done
#for f in *.txt;do sed -i '/^\s*$/d' "$f";done
for f in *.txt;do awk '!a[$0]++' "$f" > txt.tmp;/bin/mv -f txt.tmp "$f";done