Friday, January 31, 2014

Use awk

This is handle one line to update double-quote to the beginning and end of each line of a file. And put plus sign at the end of the line. The purpose for this is that I want to copy the text file as a string to java String

 cat test.msg  | awk '{printf("\"%s\" +\n", $0);}'

Thursday, January 30, 2014

Useful Linux Commands

How To Truncate Large Files

Many times, we want to truncate some large files because of space it take. In Linux OS, you have few options. The first one will be using truncate utility.
    truncate -s 0 myLargeFile.log
The other one is:
    > myLargeFile.log
The above 2 commands are the same. But the second one cannot be used with sudo.

Rotate Log Files Using logroute Utility


A good explanation can be found here:

The Ultimate Logrotate Command Tutorial with 10 Examples

ls in Windows

echo dir %1 > %systemroot%\system32\ls.bat