"sed" to check file size & echo " " to destination file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting "sed" to check file size & echo " " to destination file
# 8  
Old 04-28-2009
Hammer & Screwdriver

you can use the following script to have a copy from the old messages file or you can remove it

#!/bin/ksh

SIZE=128
MESS_SIZE=`du -k /var/adm/messages |awk '{ print $1 ; }' `
if [ $MESS_SIZE -gt $SIZE ] ;
then
mv /var/adm/messages /var/adm/messages.1
#or you can remove it
#rm /var/adm/messages
touch /var/adm/messages
fi
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

5. 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

6. 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

7. 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

8. 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

9. 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

10. 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
Login or Register to Ask a Question
getitimer(2)							System Calls Manual						      getitimer(2)

NAME
getitimer(), setitimer() - get and set value of interval timer SYNOPSIS
DESCRIPTION
The function stores the current value of the timer specified by which into the structure pointed to by value. The function sets the timer specified by which to the value specified in the structure pointed to by value, and if ovalue is not a null pointer, stores the previous value of the timer in the structure pointed to by ovalue. The header declares the structure: If it_value is non-zero, it indicates the time to the next timer expiration. If it_interval is non-zero, it specifies a value to be used in reloading it_value when the timer expires. Setting it_value to 0 disables the timer, regardless of the value of it_interval. Setting it_interval to 0 disables the timer after its next expiration (assuming it_value is non-zero). Implementations may place limitations on the granularity of timer values. For each interval timer, if the requested timer value requires a finer granularity than the implementation supports, the actual timer value will be rounded up to the next supported value. Timer values smaller than the resolution of the system clock are rounded up to this resolution. The machine-dependent clock resolution is seconds, where the constant is defined in To make sure that a process gets at least as much time as requested, the timer value is rounded up to the next timer tick (a timer tick is the smallest supported value). The timer value is rounded up to the next timer tick, because the timer may be initialized somewhere between timer ticks. If a is followed by a without a timer tick in between, it is possible that the value returned by may be more than the initial value requested by due to this rounding. Implementations may place limitations on the timer value. Timer values larger than an implementation-specific maximum value are rounded down to this maximum. The maximum values for the three interval timers are specified by the constants and defined in On all implementa- tions, these values are guaranteed to be at least 31 days (in seconds). An XSI-conforming implementation provides each process with at least three interval timers, which are indicated by the which argument: Decrements in real time. A signal is delivered to the process when this timer expires. Decrements in process virtual time. This timer runs only when the process is executing. A signal is delivered to the process when the timer expires. Decrements both in process virtual time and when the system is running on behalf of the process. This timer is designed to be used by interpreters in sta- tistically profiling the execution of interpreted programs. Each time the timer expires, a signal is delivered to the process. In addition to the above timers, HP-UX provides the following three per-thread interval timers for threads, which are indicated by the which argument: Decrements in real time. A signal is delivered to the thread which set this timer when the timer expires. Decrements in thread virtual time. This timer runs only when the thread is executing. A signal is delivered to the thread which set this timer when the timer expires. Decrements both in thread virtual time and when the system is running on behalf of the thread. Each time the timer expires, a signal is delivered to the thread which set this timer. Since a signal can interrupt in-progress system calls, programs using this timer must be prepared to restart the interrupted system call. Interval timers are not inherited by a child process across a but are inherited across an Three macros for manipulating time values are defined in Set a time value to zero. Test if a time value is non-zero. Compare two time values. (Beware that and do not work with the macro.) The timer used with is also used by (see alarm(2)). Thus successive calls to and set and return the state of a single timer. In addition, a call to sets the timer interval to zero. The interaction between and any of or is unspecified. RETURN VALUE
Upon successful completion, or returns 0. Otherwise, -1 is returned and is set to indicate the error. ERRORS
The function will fail if: The value argument is not in canonical form. (In canonical form, the number of microseconds is a non-negative integer less than 1,000,000 and the number of seconds is a non-negative integer.) The and functions may fail if: The which argument is not recognized. The value structure specified a bad address. Reliable detection of this error is implementation dependent. EXAMPLES
The following call to sets the real-time interval timer to expire initially after 10 seconds and every 0.5 seconds thereafter: AUTHOR
was developed by the University of California, Berkeley. SEE ALSO
alarm(2), exec(2), ualarm(2), usleep(2), pthread_attr_setscope(3T), pthread_create(3T), pthread_sigmask(3T), sleep(3C), signal(5). CHANGE HISTORY
First released in Issue 4, Version 2. getitimer(2)