firewall-cmd, xargs and formatting

firewall-cmd --direct --get-all-rules | xargs -n1 echo
ipv4
nat
PREROUTING
1
!
--src
172.30.25.0/24
--dst
10.0.25.1
-p
tcp
--dport
3050
-j
DNAT
--to
172.30.25.168:3050
-m
comment
--comment
LVS -> server

If you finished with such unformatted text, you can use the parameter -i

[root@db3 ~]# firewall-cmd --direct --get-all-rules | grep "168\|.25.1\s"| head -n 2  | xargs -n 1 -i echo "{}"
ipv4 nat PREROUTING 1 ! --src 172.30.25.0/24 --dst 10.0.25.1 -p tcp --dport 3050 -j DNAT --to 172.30.25.168:3050 -m comment --comment LVS -> server
  1. No comments yet.

  1. No trackbacks yet.