Ralf Wildenhues wrote: > It's even easier to read this way IMVHO (and just as portable): > > sed_extract_condition2=' > /^ *'"$escaped_dep"' *\[\(.*\)\] *$/ s//\1/p > '
Well, "easier to read" means that you have understood this paragraph from the 'sed' specification [1] If an RE is empty (that is, no pattern is specified) sed shall behave as if the last RE used in the last command applied (either as an address or as part of a substitute command) was specified. or from the GNU sed documentation [2] The empty regular expression ‘//’ repeats the last regular expression match (the same holds if the empty regular expression is passed to the s command). Note that modifiers to regular expressions are evaluated when the regular expression is compiled, thus it is invalid to specify them together with the empty regular expression. It counts as an advanced feature of 'sed' for me. Bruno [1] http://pubs.opengroup.org/onlinepubs/9699919799/utilities/sed.html [2] http://www.gnu.org/software/sed/manual/html_node/Addresses.html