Hi all
I have the following example:
Code:
$ cat file | tr -s ' ' > file
And if I check my file later, it had some text before but now is blank.
but this example
Code:
$ cat file | tr -s ' ' >> file
If I check my file later, it contains my output exactly as it should from
.
I looked it up and it says this:
Quote:
Redirecting output
N > TARGET
The TARGET is truncated before writing starts.
Appending redirected output
N >> TARGET
The TARGET is not truncated before writing starts.
|
I am assuming truncated is the reason example 1 gives me a blank file while example 2 is not truncated and the reason why my file still contains useful information.
But what is truncated and what does it mean? Why would you want to truncate the file?
Thanks