Sunday, January 6, 2008

One step diff of command output and a file

The diff command is able to read standard input, so you can, for example, do the following to compute the difference between command output and a file:
svn di | diff - file.txt The alternative, two step approach would be to write the output of svn di to file (svn di > tmp.diff) and then diff that against against file.txt (diff tmp.diff file.txt).

Sources

  • man diff

No comments:

Post a Comment