Suppose I have a file iptables_manager.py and want to insert a line after a particular line.
Input:
tables['filter'].add_chain('local')
tables['filter'].add_rule('neutron-filter-top', '-j $local',
wrap=False)
builtin_chains = {4: {'filter': ['INPUT', 'OUTPUT', 'FORWARD']},
6: {'filter': ['INPUT', 'OUTPUT', 'FORWARD']}}
Output:
tables['filter'].add_chain('local')
tables['filter'].add_rule('neutron-filter-top', '-j $local',
wrap=False)
tables['filter'].add_rule('FORWARD', '-p tcp --tcp-flags SYN,RST SYN -j TCPMSS --set-mss 1360',
wrap=False, top=True)
builtin_chains = {4: {'filter': ['INPUT', 'OUTPUT', 'FORWARD']},
6: {'filter': ['INPUT', 'OUTPUT', 'FORWARD']}}
Is there an easy way to achieve this using bash scripting?
Thanks for your help in advance.