Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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

Thanks!

share|improve this question
add comment

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.

1 Answer

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
add comment

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