thanks! but now it only changes the first array of data, operates with the first three lines (and I have a lot of all those <date></date><text></text><name></name>).
so, I wonder, how to make it to operate with the whole input, is there some kind of global switch?
This is because you spread the command over two lines and you cannot do that like this.. Also, this command would not work since sed is line based, you would have to join the next lines with the N command, e.g.:
sed '/<date>/{N;N;s|.*<date>\(.*\)</date>.*<text>\(.*\)</text>.*<name>\(.*\)</name>.*|\3 on \1: \2|}' infile
however, if I use GNU sed version 4.1.5 (from ports) then, yes, it works without errors, but also without any results, I'd say: the sed command above we were testing should output:
some_name - some_text
, but it just prints the contents of the file 'data' without applying any filters.
Hi, as I wrote in my first post, this command would not work since sed is line based, you would have to join the next lines with the N command (I gave an example).
so, as I supposed after your first answer, it seems that it just can't use a two-line search pattern, but can only operate split lines as a substitute pattern.