View Single Post
  #5   (View Single Post)  
Old 2nd February 2010
J65nko J65nko is offline
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 4,131
Default

An example using the '$' address, mentioned in the quote by Carpetsmoker from the FreeBSD sed(1) man page:
Code:
$ cat animal.sed

1 {
   i\
A list of animals in our zoo\
----------------------------
}


$ {
   a\
==== END of LIST ====
}
A sample file
Code:
$ cat animal.txt
giraffe
lion
elephant
The result:
Code:
$ sed -f animal.sed animal.txt

 A list of animals in our zoo
----------------------------
giraffe
lion
elephant
==== END of LIST ====
Now we will use a second file
Code:
$ cat animal2.txt
ostrich
hyena
gorilla
Telling sed(1) to process both files
Code:
$ sed -f animal.sed animal*.txt
A list of animals in our zoo
----------------------------
giraffe
lion
elephant
ostrich
hyena
gorilla
==== END of LIST ====
So this a simulation of the behaviour of the GNU/FreeBSD -I option by OpenBSD's sed.

The -i flag equivalent would be
Code:
$ sed -f animal.sed animal.txt ; sed -f animal.sed animal2.txt

A list of animals in our zoo
----------------------------
giraffe
lion
elephant
==== END of LIST ====

A list of animals in our zoo
----------------------------
ostrich
hyena
gorilla
==== END of LIST ====
Note: for readability some whitespace added.
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump
Reply With Quote