Omit empty lines.

This commit is contained in:
Manuel Friedli 2020-08-04 18:14:49 +02:00
parent 11c246b02c
commit 265507452c
1 changed files with 2 additions and 2 deletions

View File

@ -471,9 +471,9 @@ banned="$(exec_as_root fail2ban-client get "${jail}" banip)"
connections=$(ss -HOn state established "( sport = :${port} )" | tr -s '[:blank:]' | cut -d' ' -f5)
# IPv6-mapped-IPv4: [::ffff:192.168.0.1]:443
echo "${connections}" | grep '^\[::ffff:' - | cut -d: -f4 | cut -d] -f1 > "${fileraw}"
echo "${connections}" | grep '^\[::ffff:' - | cut -d: -f4 | cut -d] -f1 | grep -v '^$' > "${fileraw}"
# Pure IPv4: 192.168.0.1:443
echo "${connections}" | grep -v '^\[' - | cut -d: -f1 >> "${fileraw}"
echo "${connections}" | grep -v '^\[' - | cut -d: -f1 | grep -v '^$' >> "${fileraw}"
# Group and sort the data into the subnet-specific files.
sort "${fileraw}" > "${file32}"