I have a file
root@server [~]# cat /root/list12
11.22.33.44
22.33.44.55
33.44.55.66
33.44.55.66
33.44.55.66
I try to pass to array and display unique.
root@server[~]# cat /root/test12.sh
#!/bin/bash
#delcare array badips and accumulate values to array elemenrs
badips=( $( cat /root/list12 | while read entry
do
echo -e "\n $entry"
done ) )
echo ${badips[@]/%/ --- }
But output is
root@server [~]# /root/test12.sh
11.22.33.44 --- 22.33.44.55 --- 33.44.55.66 --- 33.44.55.66 --- 33.44.55.66 ---
I need uniq entire only. No repitition.
Desired output.
11.22.33.44 --- 22.33.44.55 --- 33.44.55.66