As I described earlier, before executing a sed command, the tool will check to see if the addresses correspond. This can be a concrete address, a range of addresses or a regular expression to match on the line. In the following table, you will find the methods for defining the addresses:
Address
What it means
n
The count starts from 1, and it will mean the n-th row.
$
The last line of the input
/regex/
It will match on the regex pattern.
If there is a -r option for the tool, it will use the extended regular expressions, otherwise the regular one.
/regex/I
Just like the one above, with the difference that this will not match cases also.
Address_1,Address_2
Match all of the lines between the two addresses.
Address_1~Address_2
Start from Address_1 and stop with Address_2. So 1~2 will result in matching to all of the unpaired lines (1 3 5 7 ...)
The addresses refer to lines (delimited with the new line => n character), and they include the borders. If the sed does not find the end of a range, it will skim through the whole stream. Appending the exclamation (!) character after the address will negate the address and refer to the complementing ones.
In the last two methods, the address can be any of the first four, if you do not give an address prior to a sed command that will be executed for all the lines.