luigi6699
07-04-2005, 04:48 PM
I'm trying to automate opening a port on my system. In order to make the port opening permanent, I would like to use the PERMIT line in my rc.firewall script. I can grep out the fact that the target line is number 45 but how can I use a shell command to add to or replace this line?
Presently, the output of
grep -n PERMIT= ~/rc.firewall |grep 45 |cut -d ":" -f2
is
PERMIT="22 21"
that is the target line. Is there a way to use echo, cat, awk or sed to rewrite that line as
PERMIT="22 21 192.168.168.168:80"
instead?
Presently, the output of
grep -n PERMIT= ~/rc.firewall |grep 45 |cut -d ":" -f2
is
PERMIT="22 21"
that is the target line. Is there a way to use echo, cat, awk or sed to rewrite that line as
PERMIT="22 21 192.168.168.168:80"
instead?