1

For separation of concerns, configuration edition in production is done by a ops or support, not development team. What is reliable option to enable ops/support to check the sed editions are correct?

A number of lines edited or all edited lines on the standard output would work for example. Does sed offer such options?

Thanks.

1
  • Sounds like you need a versionning system (Subversion? cvs ? git ?) (for anything text/script/source). That will allow you to see what changed, have tags, branches, ability to revert to last known good version, etc. Commented Jan 14, 2014 at 12:16

2 Answers 2

2

It depends on what you want. You can simply do a context diff between the input and the output, or you can arrange for sed to only print the lines it changes by using -n to suppress the normal printing and adding p after any substitute commands. If you're using a or i, you'll have to work a bit harder.

2

If you are familiar with diff (or vim), you can check the modifications without modifying the files like:

diff ORIGINAL_FILE <(sed 's/foo/bar/g' ORIGINAL_FILE)

Or:

vimdiff ORIGINAL_FILE <(sed 's/foo/bar/g' ORIGINAL_FILE)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.