#!/bin/bash
echo -n "请输入数字(多个数字间用空格隔开): "
read s
a=($s)
l=$((${#a[@]}-1))
for i in `seq 1 $l`do
f=true
for j in `seq $l -1 $i`do
if [ ${a[$j]} -gt ${a[$((j-1))]} ]then
m=${a[$j]}
a[$j]=${a[$((j-1))]}
a[$((j-1))]=$m
f=false
fi
done
if $fthen
break
fi
done
echo ${a[@]}
#!/bin/bash####/autorun/aa/yy.log是原始数据的路径,自己替换,注意先删除第一行的enbid rsrp,最后结果会加上
count=`cat /autorun/aa/yy.log|wc -l`
cat /autorun/aa/yy.log|awk '{print $1}' >/autorun/aa/yy2.log
let i=0
arr=()
while read line
do
arr[$i]=$line
let i=i+1
done </autorun/aa/yy2.log
len=${#arr[*]}
let len=len-1
for((i=0i<$leni++))
do
let len=len-i
for((j=0j<lenj++))
do
let k=j+1
if [ ${arr[$j]} -ge ${arr[$k]} ]then
temp=${arr[$k]}
arr[$k]=${arr[$j]}
arr[$j]=$temp
fi
done
done
echo "enbid rsrp">/autorun/aa/yy3.log
len=${#arr[*]}
for((i=0i<$leni++))
do
echo "`cat /autorun/aa/yy.log|grep ''${arr[$i]}''`">>/autorun/aa/yy3.log
done
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)