I have a list of IP's such as
35.195.23.184 134.209.172.147 207.90.244.14 179.43.191.98 77.90.22.16 222.95.163.138 95.214.53.91 45.230.66.15 199.45.155.111 5.8.11.202 185.191.126.248 154.83.15.156 71.6.232.28 35.204.124.189 141.98.11.178 64.62.197.44 64.62.197.36 64.62.197.33 185.242.226.99 46.19.69.70 114.33.100.55 95.214.55.79 114.35.57.211 162.191.196.61 87.120.126.85 2.196.195.65 118.163.142.112 80.82.77.202 182.44.10.178 114.38.214.165 175.107.1.178 122.116.134.171 109.205.213.198 178.215.238.69 122.116.158.160 93.174.93.12 147.45.112.17 59.126.25.244 59.126.254.199 40.83.134.151 125.228.162.168 220.134.106.248 45.115.89.120 4.255.98.186 87.120.114.229 45.84.89.3 46.174.191.28 95.214.53.211 141.98.11.175 125.228.214.129 36.139.63.123 180.149.126.8 122.116.183.60 185.82.219.179 165.154.206.35 106.75.146.146 106.75.169.16 59.126.115.226 59.182.82.59 47.91.91.123 34.77.49.75 45.148.10.206 45.156.130.18 87.236.176.150 167.94.145.96 199.45.154.130 205.210.31.30 147.185.132.30 64.62.156.83 35.203.210.49 100.0.161.38 1.34.209.79
(don't worry about having them posted here, they all have been trapped as aggressive hacking sources by a honeypot.
Now within a bash-shell, I want to reformat this list - the spaces between them have to be replaced by a comma and a space (, ) in order to easily use them in a hosts.deny file. My problem: the normal bash- or sed-replacement always fails with an error "bad substitution". Seems I need to escape the space/comma somehow.
So my question: how do I replace all the spaces in this list by a comma/space-combination?
Thanks!
Works for me. Are you quoting the substitution properly?
Using any awk: