07-07-2009
@Ramesh_srk
Yes Ramesh the directory has a lot of files having xyz* files.
@kshji
Thanks a lot. Its working as expected.
Just wanted to clarify one more thing. There are more than 100 xyz* files present in the directory and I'm checking for only today's file which will be one or two and the others are old files. If I use a for loop will it not take more time?
coz I have search for a lot of different files in different directories created for the day. All these directories will have 100 of files with the same starting charcters as the ones I search for. So if I use a "for" loop wont the script take more time and more CPU utilization. Just wanted to know.
In between your explanation of unix treats the variables and conditions is very helpful. Thanks a ton for that too.
Thanks
Last edited by achilles5; 07-07-2009 at 09:57 AM..
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi
I am writing a script file which sends the log files along with their size in a folder named log to a file called temp.log using the following cmd:
ls -st 190_GSTV_HUX_003QISCGSK026** >> /home/user/temp.log
the temp.log looks like this:
16 190_GSTV_HUX_003QISCGSK026_message070321.log
... (11 Replies)
Discussion started by: kiran1112
11 Replies
2. Shell Programming and Scripting
Hi,
I have a text file, foo.txt, it looks something like below. In the file there is a line that gives the date in the form of: Mon Jun 15 11:09:31 2008. I need to find which date is the newest and then store certain details of that list data to another file. So, in this sample text file, I... (6 Replies)
Discussion started by: boolean2222
6 Replies
3. Shell Programming and Scripting
Hi,
I need to execute a crontab based on a condition where one SH file should be executed only based on the output of a file in a folder.
I have written the following cron job which is not working.
00 01 * * * read a < /px/batch/reslut.txt && && sh /px/batch/check.sh
where my... (2 Replies)
Discussion started by: shanth_chandra
2 Replies
4. Solaris
I know how to check if any file has a unix process using a file by looking at 'lsof <fullpath/filename>' command.
I think using lsof is very expensive. Also to make it accurate we need to inlcude fullpath of the file.
Is there another command that can tell if a file has a truely active... (12 Replies)
Discussion started by: kchinnam
12 Replies
5. Shell Programming and Scripting
This should be a simple script, but can't find one with google search.
I just need to find the file that is in many directories, then overwrite that file with a newer version i.e.
find file.jar then overwrite with /root/file.jar
All I get in searches is substitute text with new test inside... (1 Reply)
Discussion started by: haircat
1 Replies
6. Shell Programming and Scripting
CMD=$(find "${Release_Container}" -iname "${Release_Name}"_Release.txt)
for i in `cat $CMD`
do
if ];then
cd ${Sandbox_dir}
CMD1=$(find "${Sandbox_dir}"/* -iname "${Release_Name}" -type d | awk -F/ '{print $(NF)}' | head -1 )
if ];then
echo -e "################### CHECKOUT START... (2 Replies)
Discussion started by: anuragpgtgerman
2 Replies
7. Shell Programming and Scripting
Hello,
Can you please help me one this:
I have two servers: Server A and server B.
Every day on 03.00AM in only one on these two servers (randomly)is generated one file, lets say file.txt.
I want to copy this file also to the other server.
I want to create a perl script that does... (2 Replies)
Discussion started by: arrals_vl
2 Replies
8. Shell Programming and Scripting
I am fairly new to programming and trying to resolve this problem. I have the file like this.
CHROM POS REF ALT 10_sample.bam 11_sample.bam 12_sample.bam 13_sample.bam 14_sample.bam 15_sample.bam 16_sample.bam
tg93 77 T C T T T T T
tg93 79 ... (4 Replies)
Discussion started by: empyrean
4 Replies
9. UNIX for Dummies Questions & Answers
Dear All,
I'm new to unix scripting. I'm trying to write an utility script which has to check if one file is newer than another one. $3 $4 $5 $6 are files .txt. Help me please.
for i in $3 $4 $5 $6
do
if
then
echo "$1 is newer than $i"
else
echo "$i is newer than $1"
fi (9 Replies)
Discussion started by: Manueldo
9 Replies
10. Shell Programming and Scripting
I only want the file copied if it is newer. But it still copies the file?
zip -u Ubuntu_Documents.zip ./*
cp -u Ubuntu_Documents.zip $DOCS_Backup/Ubuntu_Documents_`date +"%Y-%m-%d-%H-%M"`.zip (5 Replies)
Discussion started by: drew77
5 Replies
LEARN ABOUT DEBIAN
rdiff-backup-statistics
RDIFF-BACKUP(1) User Manuals RDIFF-BACKUP(1)
NAME
rdiff-backup-statistics - summarize rdiff-backup statistics files
SYNOPSIS
rdiff-backup-statistics [--begin-time time] [--end-time time] [--minimum-ratio ratio] [--null-separator] [--quiet] repository
DESCRIPTION
rdiff-backup-statistics reads the matching statistics files in a backup repository made by rdiff-backup and prints some summary statistics
to the screen. It does not alter the repository in any way.
The required argument is the pathname of the root of an rdiff-backup repository. For instance, if you ran "rdiff-backup in out", you could
later run "rdiff-backup-statistics out".
The output has two parts. The first is simply an average of the all matching session_statistics files. The meaning of these fields is
explained in the FAQ included in the package, and also at http://rdiff-backup.nongnu.org/FAQ.html#statistics.
The second section lists some particularly significant files (including directories). These files are either contain a lot of data, take
up increment space, or contain a lot of changed files. All the files that are above the minimum ratio (default 5%) will be listed.
If a file or directory is listed, its contributions are subtracted from its parent. That is why the percentage listed after a directory
can be larger than the percentage of its parent. Without this, the root directory would always be the largest, and the output would be
boring.
OPTIONS
--begin-time time
Do not read statistics files older than time. By default, all statistics files will be read. time should be in the same format
taken by --restore-as-of. (See TIME FORMATS in the rdiff-backup man page for details.)
--end-time time
Like --begin-time but exclude statistics files later than time.
--minimum-ratio ratio
Print all directories contributing more than the given ratio to the total. The default value is .05, or 5 percent.
--null-separator
Specify that the lines of the file_statistics file are separated by nulls ( ). The default is to assume that newlines separate.
Use this switch if rdiff-backup was run with the --null-separator when making the given repository.
--quiet
Suppress printing of the "Processing statistics from session..." output lines.
BUGS
When aggregating multiple statistics files, some directories above (but close to) the minimum ratio may not be displayed. For this reason,
you may want to set the minimum-ratio lower than need.
AUTHOR
Ben Escoto <ben@emerose.org>, based on original script by Dean Gaudet.
SEE ALSO
rdiff-backup(1), python(1). The rdiff-backup web page is at http://rdiff-backup.nongnu.org/.
Version 1.2.8 March 2009 RDIFF-BACKUP(1)