Sponsored Content
Top Forums Shell Programming and Scripting "sed" to check file size & echo " " to destination file Post 302145265 by jockey007 on Tuesday 13th of November 2007 02:46:40 PM
Old 11-13-2007
"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
 

10 More Discussions You Might Find Interesting

1. HP-UX

To give the "unzip" permissions & "create" file permissions

Hi, I am a Unix Admin. I have to give the permissions to a user for creating new file in a directory in HP-Ux 11.11 system since he cannot able to create a new file in the directory. Thanks in advance. Mike (3 Replies)
Discussion started by: Mike1234
3 Replies

2. Shell Programming and Scripting

cat $como_file | awk /^~/'{print $1","$2","$3","$4}' | sed -e 's/~//g'

hi All, cat file_name | awk /^~/'{print $1","$2","$3","$4}' | sed -e 's/~//g' Can this be done by using sed or awk alone (4 Replies)
Discussion started by: harshakusam
4 Replies

3. Shell Programming and Scripting

Help to change the file with "sed" and "awk"

Hi experts I want your help to change the file format to my wanted version, please give me a hand thanks $cat file install pass make os pass make build kernel failed usb storage pass chane to | *install* | *make os* | *make build kernel* | *usb storage* | | pass | pass... (7 Replies)
Discussion started by: yanglei_fage
7 Replies

4. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

5. Shell Programming and Scripting

how to use "cut" or "awk" or "sed" to remove a string

logs: "/home/abc/public_html/index.php" "/home/abc/public_html/index.php" "/home/xyz/public_html/index.php" "/home/xyz/public_html/index.php" "/home/xyz/public_html/index.php" how to use "cut" or "awk" or "sed" to get the following result: abc abc xyz xyz xyz (8 Replies)
Discussion started by: timmywong
8 Replies

6. SuSE

Difference in file size between "ls -l" and "du -a"

mail:/var/lib/named/proc # ls -l |grep kcore -r-------- 1 root root 140737486266368 Jun 3 19:47 kcore mail:/var/lib/named/proc # du -a |grep kcore 0 ./kcore System is SuSE 11.2 SP1. The system appears to run correctly, and the output of df -v shows the correct disk... (1 Reply)
Discussion started by: jgt
1 Replies

7. Shell Programming and Scripting

finding the strings beween 2 characters "/" & "/" in .txt file

Hi all. I have a .txt file that I need to sort it My file is like: 1- 88 chain0 MASTER (FF-TE) FFFF 1962510 /TCK T FD2TQHVTT1 /jtagc/jtag_instreg/updateinstr_reg_1 dff1 (TI,SO) 2- ... (10 Replies)
Discussion started by: Behrouzx77
10 Replies

8. UNIX for Dummies Questions & Answers

Using "mailx" command to read "to" and "cc" email addreses from input file

How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address and column 3 contains “cc” e-mail address to include with same email. Sample input file, email.txt Below is an sample code where... (2 Replies)
Discussion started by: asjaiswal
2 Replies

9. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies

10. AIX

Apache 2.4 directory cannot display "Last modified" "Size" "Description"

Hi 2 all, i have had AIX 7.2 :/# /usr/IBMAHS/bin/apachectl -v Server version: Apache/2.4.12 (Unix) Server built: May 25 2015 04:58:27 :/#:/# /usr/IBMAHS/bin/apachectl -M Loaded Modules: core_module (static) so_module (static) http_module (static) mpm_worker_module (static) ... (3 Replies)
Discussion started by: penchev
3 Replies
strerr(8)						      System Manager's Manual							 strerr(8)

NAME
strerr - Receives error messages from the STREAMS log driver SYNOPSIS
/usr/sbin/strerr [-a sys_admin_mail_name] [-d logdir] PARAMETERS
Specifies the mail name of the user to receive the message via mail. This is the system administrator by default. Specifies the directory to contain the error log file. This is /var/adm/streams by default. DESCRIPTION
The strerr daemon receives error messages from the STREAMS log driver (strlog) for addition to the STREAMS error log files (error.mm.dd) in the STREAMS error logger directory (/var/adm/streams by default). When first called, the strerr daemon creates the log file error.mm.dd. This is a daily log file, where mm indicates the month and dd indicates the day of the logged messages. The strerr daemon then appends each error message that it subsequently receives from the STREAMS log driver to the log file. STREAMS error log messages have the following format: seq_num std_time ticks_time flags mod_ID sub_ID msg_text where: The error sequence number. The time the message was sent, in the format hh:mm:ss. The time the message was sent, measured in machine ticks since the last boot. Can be any of the following indicators: Indicates that the message has also been saved in the process's trace log. Indi- cates that the message signaled a fatal error. Indicates that the message is to be sent to the system administrator or specified user via mail. The module identification number of the trace message source. The subidentification number of the trace message source. The trace message text. The strerr daemon will run continuously until terminated by the user. FILES
The error log file or files on which strerr operates. NOTES
Only one strerr process can open the STREAMS log driver at a time. This restriction is intended to maximize performance. The STREAMS error logging mechanism works best when it is not overused. The strerr daemon can degrade STREAMS performance by affecting the response, throughput, and other behaviors of the drivers and modules that invoke it. The daemon will also fail to capture messages if drivers and modules generate messages at a higher rate than its optimum read rate. Missing sequence numbers among the messages in a log file indicate that messages have been lost. RELATED INFORMATION
Interfaces: strlog(7). delim off strerr(8)
All times are GMT -4. The time now is 03:33 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy