Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0
tag 21128 notabug
close 21128
stop
On 24/07/15 09:20, liuquan wrote:
> Dear, engineer!
>
> I'm writing this E-mail to you since I think I've found something wrong in
> Ubuntu!
>
> My Operating System here is Ubuntu Kylin 14.04.
>
> I find a question about command 'paste' in command line.
>
> Support there is a file called "test.txt", and its content is the next 2
> lines:
>
> ab
>
> cd
>
> If I run the command "paste test.txt", the content of this file will be print
> at STDOUT. However, when I ran the command "paste test.txt > test.txt" I
> found that the file "test.txt" became an empty file. Here comes the question,
> what's going on? Can you help me?
The shell truncated the file before paste could read it.
You need to write to a temp file first. For details see:
http://www.pixelbeat.org/docs/unix_file_replacement.html
thanks,
Pádraig.