Problem with Bash output redirection
        Posted  
        
            by Aman Jain
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Aman Jain
        
        
        
        Published on 2008-09-23T19:29:26Z
        Indexed on 
            2010/03/25
            4:03 UTC
        
        
        Read the original article
        Hit count: 391
        
I was trying to remove all the lines of a file except the last line but the following command did not work, although file.txt is not empty.
$cat file.txt |tail -1 > file.txt
$cat file.txt
Why is it so?
© Stack Overflow or respective owner