I have a command fatrace/fatrace -t | grep "/home/eric/test.txt", which runs fatrace and filters down the result by piping into grep.  What should I do if I want to run this as a daemon and output the result to a file?  
            Asked
            
        
        
            Active
            
        
            Viewed 221 times
        
    1 Answers
2
            you can simply use > or >> in order to pipe output to a file:
This will replace the content of /tmp/myFile with the grep output:
fatrace/fatrace -t | grep "/home/eric/test.txt" > /tmp/myFile
And this will append the grep output to the file:
fatrace/fatrace -t | grep "/home/eric/test.txt" >> /tmp/myFile
 
    
    
        Nir Levy
        
- 12,750
- 3
- 21
- 38
- 
                    That's what I thought... I ran `sudo fatrace/fatrace -t | grep "/home/eric/test.txt" >> ./monitor.txt &` but nothing gets appended to monitor.txt... – etang Jan 07 '16 at 21:55
- 
                    1@etang It works, but due to buffering it's written in large blocks so it can take a while before you see the first line. See [this question](http://stackoverflow.com/questions/7161821/how-to-grep-a-continuous-stream). – that other guy Jan 07 '16 at 22:11
