▲ | ykonstant 7 hours ago | |
The most portable way to do it with minimal overhead is with sed:
which generalizes to more terms. Easier to remember and just as portable is
but now you need to launch a full awk.For more ways see https://unix.stackexchange.com/questions/55359/how-to-run-gr... | ||
▲ | jrpelkonen 4 hours ago | parent [-] | |
These are good suggestions, but maybe it’s worth noting that one of the solutions offered in the article is not equivalent:
This will only match if the subpatterns, i.e. thing1 & thing2, are in this order, and also require that the patterns do not overlap. |