I wanted to diff two files. One of them needed some seds on each line and sorting. I wanted to do that on the fly, without leaving a massaged intermediate file lying around.
colordiff --unified <(cat orphaned_permalinks.txt | sed 's@http://www.georgevreilly.com/@@' | sed 's/.aspx$/.html/' | sort) links.txt | less -R
- Use process substitution—<(cat | sed | sort)—to generate one argument to colordiff. The other argument is simply links.txt.
- The first sed is using @ as the delimiter rather than the more usual /, since the pattern contains multiple slashes that would otherwise need to be escaped.
- Pipe the colored output into less -R (aka --RAW-CONTROL-CHARS).