Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Possible Duplicate:
Why does sed act differently depending on the output file?

I wonder why this command will simply replace the content of file1 with the content of file2, instead of the combination the original content of the two files?

paste file1 file2 > file1


share|improve this question

marked as duplicate by Michael Mrozek May 9 '12 at 22:58

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

The redirection clobbers file1. This is why we redirect to a different filename and rename after.

share|improve this answer
Thanks! Could you explain what "the redirection clobbers file1" mean? – Tim May 9 '12 at 22:56

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