Quote:
Originally Posted by blowtorch
Does this help?
Code:
echo "a big black dog" | sed -e 's/big \(.*\) dog/small \1 cat/'
a small black eared cat
The \1 means that the first pattern that matches (.*) (any word) is put in. Similarly, another (second) matching pattern can also be put in. As an example:
Code:
echo "a big black eared dog ran away" | sed -e 's/big \(.*\) dog \(.*\)/small \1 cat \2/'
a small black eared cat ran away
|
Torch,
this is the not the way it works
Code:
echo "a big black dog" | sed -e 's/big \(.*\) dog/small \1 cat/'
a small black cat