Login  Register

Re: Update script (fw_upgrade)

Posted by hans2 on Mar 04, 2016; 10:18pm
URL: https://itus.accessinnov.com/Update-script-fw-upgrade-tp43p291.html

Roadrunnere42 wrote
Been playing with the fw_upgrade script gain It checks for new snort rules and also deletes new deleted snort rules, but im not sure if the command sed -i writes the whole file or just changes. I only want the changes so  as not to write whole file again, have you got any ideals?
Not sure, I was checking https://en.wikipedia.org/wiki/Sed#Mode_of_operation 

"
sed is a line-oriented text processing utility: it reads text, line by line, from an input stream or file, into an internal buffer called the pattern space. Each line read starts a cycle. To the pattern space, sed applies one or more operations which have been specified via a sed script. sed implements a programming language with about 25 commands that specify the operations on the text. For each input line, after running the script sed ordinarily outputs the pattern space (the line as modified by the script) and begins the cycle again with the next line.
...
"

This read to me as sed processes the entire file in pattern space, applies the changes and then commits the file back
No more: Shield Pro v1, Chaos Calmer, FW 1.51 SP1