Wondering if someone could help me with this in any scripting/programming language. I have a list of ordered IP addresses and I want to unorder them. So for example, if I had a file like this:
I would want to make it so that is unordered. It does not matter the outcome as long as they are not in ascending/descending order. So something like the following would be acceptable:
First check whether your shell has $RANDOM.
echo $RANDOM $RANDOM
(Should give two different numbers)
We can then number the lines randomly, then sort them.
!/bin/ksh
(
cat list_of_ip_addresses | while read IP
do
echo "${RANDOM} ${IP}"
done
) | sort -n | awk '{print $2}'