标签:for lines dev 重复 one nes bash gre null
1、保持顺序并消除重复行
#!/bin/bash
unset lines
while read line ; do
# echo ‘lines length: ‘${#lines[@]}
# echo ‘read:‘$line‘ ‘${#line}
if !(echo "${lines[@]}" | grep -w $line &>/dev/null); then
# echo ‘Not Found‘
lines=("${lines[@]}" $line)
fi
done
for line in ${lines[*]}
do
echo $line
done
标签:for lines dev 重复 one nes bash gre null
原文地址:http://www.cnblogs.com/mikeyang/p/6288594.html