03-14-2002
Delete file by date or by size
Hi Everyone,
This forum has been a great help to me as a new newbie in Unix. Thanks to you all.
My ? now is I have a log file that help me keep track of errors within my program. But the size of the log file keeps growing and I am wondering if there is any command that will help me to limit the size of the log file to about 10,000 lines. Or since I capture both the date and time stamp and the error message, is there anyway I can write a code to help keep up to say about 10 days of error within my log file.
Thanks for your help.
Odogbolu98
10 More Discussions You Might Find Interesting
1. UNIX for Advanced & Expert Users
Hi in my shell script I have to do this
1. there is a file called testing.txt in /home/report directory
If the file size is 0(zero) and date is today's date, then I have to print
"Successful" else "Failed".
2. There is a file called number.txt which will have text only one line like this... (10 Replies)
Discussion started by: gsusarla
10 Replies
2. Shell Programming and Scripting
hello people
i need your help please
i want to achieve the following with the simplest, most efficient shell-tools:
i have a directory with a lot of files from users.
the script should check which partition the dir is on
if the partition with the directory is more than 90% full
... (2 Replies)
Discussion started by: scarfake
2 Replies
3. Shell Programming and Scripting
Hello everyone,
I have a folder with many files.the script (csh) runs daily and adds a new file to the folder.I need to delete the first file added that month so I will have only 30 files left every day.
Thanks. (6 Replies)
Discussion started by: offerbukra
6 Replies
4. Shell Programming and Scripting
Good day
Probably a simple script though I am new to attempting to script. I have a directory that I would like to get the size of the files and number of files for each date
ie 14 Sep 669 files 1.8g
12 Sep 221 files 500mb
Any ideas?
Thanks (1 Reply)
Discussion started by: ibaboomer
1 Replies
5. Shell Programming and Scripting
Hi guys, i am new to perl. I started reading the perl documents and try to come up with some logic.
I am trying to create a script that would go into a location, search for todays files, then searches for all .txt files from today.
If todays not found, its an error
If file size is less... (26 Replies)
Discussion started by: DallasT
26 Replies
6. UNIX for Dummies Questions & Answers
Hello gurus,
I am hoping someone can help me with the required code/script to make this work. I have the following file with records starting at line 4:
NETW~US60~000000000013220694~002~~IT~USD~2.24~20110201~99991231~01~01~20101104~... (4 Replies)
Discussion started by: chumsky
4 Replies
7. Shell Programming and Scripting
I am pretty new to scripting, so I appreciate your advice in advance.
The problem:
100 directories each containing 2 files that have the same extension with random names. The only attribute that discriminates the files is size. I would like to write a script that compares the files for size... (6 Replies)
Discussion started by: JC_1
6 Replies
8. HP-UX
Hi,
The blow code does not yeild any output.
find . -name "*.jar" -o -name "*.ksh" -o -name "*.properties" -name "*.war" -o -name "*.ear" -o -name "*.sh" -o -name "*.cfg" -exec ls -l {} \;
I wish to print the filename filesize filedate in HP-UX.
Can anyone help ? (9 Replies)
Discussion started by: mohtashims
9 Replies
9. Shell Programming and Scripting
To delete log files content older than 30 days and append the lastest date log file date in the respective logs
I want to write a shell script that deletes all log files content older than 30 days and append the lastest log file date in the respective logs
This is my script
cd... (2 Replies)
Discussion started by: sreekumarhari
2 Replies
10. Shell Programming and Scripting
I have file listed like below
-rw-r--r--+ 1 test test 17M Nov 26 14:43 test1.gz
-rw-r--r--+ 1 test test 0 Nov 26 14:44 test2.gz
-rw-r--r--+ 1 test test 0 Nov 27 10:41 test3.gz
-rw-r--r--+ 1 test test 244K Nov 27 10:41 test4.gz
-rw-r--r--+ 1 test test 17M Nov 27 10:41 test5.gz
I... (5 Replies)
Discussion started by: krish2014
5 Replies
LEARN ABOUT DEBIAN
xfs_info
xfs_growfs(8) System Manager's Manual xfs_growfs(8)
NAME
xfs_growfs, xfs_info - expand an XFS filesystem
SYNOPSIS
xfs_growfs [ -dilnrxV ] [ -D size ] [ -e rtextsize ] [ -L size ] [ -m maxpct ] [ -t mtab ] [ -R size ] mount-point
xfs_info [ -t mtab ] mount-point
DESCRIPTION
xfs_growfs expands an existing XFS filesystem (see xfs(5)). The mount-point argument is the pathname of the directory where the filesystem
is mounted. The filesystem must be mounted to be grown (see mount(8)). The existing contents of the filesystem are undisturbed, and the
added space becomes available for additional file storage.
xfs_info is equivalent to invoking xfs_growfs with the -n option (see discussion below).
OPTIONS
-d | -D size
Specifies that the data section of the filesystem should be grown. If the -D size option is given, the data section is grown to that
size, otherwise the data section is grown to the largest size possible with the -d option. The size is expressed in filesystem
blocks.
-e Allows the real-time extent size to be specified. In mkfs.xfs(8) this is specified with -r extsize=nnnn.
-i The new log is an internal log (inside the data section). [NOTE: This option is not implemented]
-l | -L size
Specifies that the log section of the filesystem should be grown, shrunk, or moved. If the -L size option is given, the log section
is changed to be that size, if possible. The size is expressed in filesystem blocks. The size of an internal log must be smaller
than the size of an allocation group (this value is printed at mkfs(8) time). If neither -i nor -x is given with -l, the log contin-
ues to be internal or external as it was before. [NOTE: These options are not implemented]
-m Specify a new value for the maximum percentage of space in the filesystem that can be allocated as inodes. In mkfs.xfs(8) this is
specified with -i maxpct=nn.
-n Specifies that no change to the filesystem is to be made. The filesystem geometry is printed, and argument checking is performed,
but no growth occurs.
-r | -R size
Specifies that the real-time section of the filesystem should be grown. If the -R size option is given, the real-time section is
grown to that size, otherwise the real-time section is grown to the largest size possible with the -r option. The size is expressed
in filesystem blocks. The filesystem does not need to have contained a real-time section before the xfs_growfs operation.
-t Specifies an alternate mount table file (default is /proc/mounts if it exists, else /etc/mtab). This is used when working with
filesystems mounted without writing to /etc/mtab file - refer to mount(8) for further details.
-V Prints the version number and exits. The mount-point argument is not required with -V.
xfs_growfs is most often used in conjunction with logical volumes (see md(4) and lvm(8) on Linux). However, it can also be used on a regu-
lar disk partition, for example if a partition has been enlarged while retaining the same starting block.
PRACTICAL USE
Filesystems normally occupy all of the space on the device where they reside. In order to grow a filesystem, it is necessary to provide
added space for it to occupy. Therefore there must be at least one spare new disk partition available. Adding the space is often done
through the use of a logical volume manager.
SEE ALSO
mkfs.xfs(8), md(4), lvm(8), mount(8).
xfs_growfs(8)