Reputation: 6608
can someone help me with unix command to truncate the contents of the files in the directory. I am using Cygwin in windows.
Upvotes: 4
Views: 2689
Reputation: 5708
If you want to truncate a file to keep the n last lines of a file, you can do something like (500 lines in this example)
mv file file.tmp && tail -n 500 file.tmp > file && rm file.tmp
Upvotes: 2