07-29-2014
Why do you want to count the files. The script I gave you won't do anything unless there are at least two files. If there are two or more files, it will execute the commands in the while loop once for each file except the 1st file. The name of the 1st file is preserved in the variable file1 and doesn't change while the name of each remaining file is stored in the variable file2 as it is processed in the loop.
You have said you want to create a temp file, but you haven't shown us what would go into that temp for nor what it would be used for. Then you said you want to do something else, but you haven't said what. Then, if there are two or more files, you said you want to compare the files; the script I gave you does that.
Did you try running the script I gave you when 0, 1, 2, and 3 files with names starting with abc2014 were present that had been created within the last hour? For each case, what did the script do wrong?
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hello all,
I would like to ask for an advice on how to deal with the following scenario.
Every now and then, our ERP system creates an interface text file with the following file format - XORD????.DLD where ???? is a sequence number. We can have 1 or more XORD files created in an hour. ... (9 Replies)
Discussion started by: negixx
9 Replies
2. UNIX for Dummies Questions & Answers
Hi,
I need to create a script whcih ill run ever hour and will check all the files which are created in that hour for an error string.
Need help in finding all the files which were created in the last 1 hour.
Thanks in Advance.
Asheesh (4 Replies)
Discussion started by: Asheesh
4 Replies
3. UNIX for Dummies Questions & Answers
I have an array "arrA" with the following contents:
A0012 Paint Shop.doc
ES001 Contract Signature.doc
Budget Plan.pdf
TS PWS.pdf
My data file "Files.dat" has the same contents:
A0012 Paint Shop.doc
ES001 Contract Signature.doc
Budget Plan.pdf
TS PWS.pdf
I have a script that compares... (0 Replies)
Discussion started by: orahi001
0 Replies
4. Shell Programming and Scripting
Hi,
I have two files, in which the second file has exactly the same contents of the first file with some additional records. Now, if I want to remove those matching lines from file2 and print only the extra contents which the first file does not have, I could use the below unsophisticated... (3 Replies)
Discussion started by: royalibrahim
3 Replies
5. Shell Programming and Scripting
Hello,
I've created the script below to compare the content of two files with a delay of an hour. After an hour, the lines that exist in both files, will be printed and executed.
The script now uses a counter to countdown 50 minutes. But what I would prefer is to check the file timestamp of... (3 Replies)
Discussion started by: taipan
3 Replies
6. UNIX for Dummies Questions & Answers
Give shell script....which takes two file names as input and compares the contents, is both are same delete second file's contents.....
I try with "diff"...... but confusion how to use "diff" with if ---else
Thanking you (5 Replies)
Discussion started by: krishnampkkm
5 Replies
7. Shell Programming and Scripting
Hello
Has anyone got an example shell script that I can use to compare the contents of two files.
The files should contain the same contents, eg.
file1.txt
apple
pear
grape
file2.txt
apple
pear
grape (2 Replies)
Discussion started by: deedaz
2 Replies
8. Shell Programming and Scripting
Hi Gurus,
I want to find the file created within one hour in solaris.
I have tried below command, but it is no lucky.
$find . -mtime -1/24, -name "abc*"
above command give me the file name which created two hours ago
find . -cmin -60, -name "abc*"
above command I got error as... (4 Replies)
Discussion started by: ken6503
4 Replies
9. UNIX for Beginners Questions & Answers
I have run the following command : od -c Results_May18.fixrank | head
Here is the result. I wanted the results in tab delimited. Thanks
$ od -c Results_May18.fixrank | head
0000000 M 0 1 6 0 1 : 1 2 9 : 0 0 0 0 0
0000020 0 0 0 0 - A T T D Y ... (2 Replies)
Discussion started by: Benard
2 Replies
10. Shell Programming and Scripting
Shell script logic
Hi
I have 2 input files like with file 1 content as (file1)
"BRGTEST-242" a.txt "BRGTEST-240" a.txt "BRGTEST-219" e.txt
File 2 contents as fle(2)
"BRGTEST-244" a.txt "BRGTEST-244" b.txt "BRGTEST-231" c.txt "BRGTEST-231" d.txt "BRGTEST-221" e.txt
I want to get... (22 Replies)
Discussion started by: pottic
22 Replies
LEARN ABOUT DEBIAN
bup-margin
bup-margin(1) General Commands Manual bup-margin(1)
NAME
bup-margin - figure out your deduplication safety margin
SYNOPSIS
bup margin [options...]
DESCRIPTION
bup margin iterates through all objects in your bup repository, calculating the largest number of prefix bits shared between any two
entries. This number, n, identifies the longest subset of SHA-1 you could use and still encounter a collision between your object ids.
For example, one system that was tested had a collection of 11 million objects (70 GB), and bup margin returned 45. That means a 46-bit
hash would be sufficient to avoid all collisions among that set of objects; each object in that repository could be uniquely identified by
its first 46 bits.
The number of bits needed seems to increase by about 1 or 2 for every doubling of the number of objects. Since SHA-1 hashes have 160 bits,
that leaves 115 bits of margin. Of course, because SHA-1 hashes are essentially random, it's theoretically possible to use many more bits
with far fewer objects.
If you're paranoid about the possibility of SHA-1 collisions, you can monitor your repository by running bup margin occasionally to see if
you're getting dangerously close to 160 bits.
OPTIONS
--predict
Guess the offset into each index file where a particular object will appear, and report the maximum deviation of the correct answer
from the guess. This is potentially useful for tuning an interpolation search algorithm.
--ignore-midx
don't use .midx files, use only .idx files. This is only really useful when used with --predict.
EXAMPLE
$ bup margin
Reading indexes: 100.00% (1612581/1612581), done.
40
40 matching prefix bits
1.94 bits per doubling
120 bits (61.86 doublings) remaining
4.19338e+18 times larger is possible
Everyone on earth could have 625878182 data sets
like yours, all in one repository, and we would
expect 1 object collision.
$ bup margin --predict
PackIdxList: using 1 index.
Reading indexes: 100.00% (1612581/1612581), done.
915 of 1612581 (0.057%)
SEE ALSO
bup-midx(1), bup-save(1)
BUP
Part of the bup(1) suite.
AUTHORS
Avery Pennarun <apenwarr@gmail.com>.
Bup unknown- bup-margin(1)