![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Development Releases: Linux Mint 4.0 Beta "Fluxbox", 4.0 Alpha "Debian" | iBot | UNIX and Linux RSS News | 0 | 01-04-2008 03:00 PM |
| Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`" | Lokesha | UNIX for Dummies Questions & Answers | 4 | 12-20-2007 01:52 AM |
| check input = "empty" and "numeric" | geoffry | Shell Programming and Scripting | 6 | 12-13-2007 05:12 AM |
| Command similar to "touch" for modify File size | sriharshareddyk | UNIX for Advanced & Expert Users | 3 | 11-15-2007 01:43 AM |
| Maximum input file size in "Diff" Command | Neeraja | UNIX for Dummies Questions & Answers | 1 | 01-17-2007 10:09 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
"sed" to check file size & echo " " to destination file
Hi,
I've modified the syslogd source to include a thread that will keep track of a timer(or a timer thread). My intention is to check the file size of /var/log/messages in every one minute & if the size is more than 128KB, do a echo " " > /var/log/messages, so that the file size will be set back to zero. If somebody can help me with a sed command to check the size of messages & to do a echo "" > messages ,if the size is greater than 128KB, I'll really grateful. Wishes Jay Last edited by jockey007; 11-13-2007 at 03:47 PM.. Reason: typo |
|
||||
|
Thanks....
Now I'm using a busybox find, which doesn't have support for "-size" argument So i think a sed command that meets the requirement would be great. Please provide a sed command to check the file & then flush that file. Wishes Jay |
|
||||
|
Hi Porter,
The output of root@WiMAX-BS:/var/log ls -ld /var/log/messages -rw------- 1 root root 41994 Jan 23 03:16 /var/log/messages ========== Well.. I was thinking like 1) use the ls command grab the size value using the sed and 2) then if it is greater than 128KB, do an echo " " > /var/log/messages Now I've crond support, so I can add a script with above logic to cron job. Thanks Jay |
|
||||
|
Oh!! That works!
Thanks a lot Porter... Have a nice day. Wishes Jay Last edited by jockey007; 11-13-2007 at 09:10 PM.. |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|