Sponsored Content
Top Forums UNIX for Advanced & Expert Users comparing shadow files with real files Post 302106424 by jim mcnamara on Thursday 8th of February 2007 10:22:12 AM
Old 02-08-2007
Code:
#/bin/ksh
# get the base real files
find /path/to/realfiles -name '*' -type f | \
while read file
do
      wc -c "$file"  | read size dummy
      echo "`basename $file` $size"
done > realfiles
# get all the shadow files
find / -type ! -name '/path/to/realfiles/*' |\
while read file
do
       wc -c "$file"  | read size dummy
       echo "`basename $file` $size  $file"
done > shadowfiles

# create a file badfiles that is a list of all the failures
awk '{
        FILENAME=="realfiles" {
                key[$1 $2]++
        }
        FILENAME=="shadowfiles" {
                if( !key[$1 $2]) { print $3 }
        }
      }'   realfiles shadowfiles > badfiles
# send email
cat badfiles | /usr/bin/mailx -s 'bad shadow files' somebody@someplace.com

Start with this code. Before you try mailing anything check both shadowfiles and realfiles and badfiles for content.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Finding files with names that have a real number greater then difined.

I am trying to find all files in a directory whose name has a real number larger then the number I am looking for. For example: . |-- delta.1.5.sql |-- delta.2.1.sql |-- delta.2.2.sql |-- delta.2.3.sql |-- delta.2.4.sql `-- delta.2.5.sql I know my database is at 2.2 so I want an... (2 Replies)
Discussion started by: harmonwood
2 Replies

2. Shell Programming and Scripting

comparing of two files with output which is not in both files

Hi I am having two files... x1 709545 709546 709547 and x2 709545 709545 709545 the output should be 709546 709547 pls help (2 Replies)
Discussion started by: suryanarayana
2 Replies

3. Shell Programming and Scripting

Need help comparing two files and deleting some things in those files!

So I have two files: File1 pictures.txt 1.1 1.3 dance.txt 1.2 1.4 treehouse.txt 1.3 1.5 File2 pictures.txt 1.5 ref2313 1.4 ref2345 1.3 ref5432 1.2 ref4244 dance.txt 1.6 ref2342 1.5 ref2352 1.4 ref0695 1.3 ref5738 1.2 ref4948 1.1 treehouse.txt 1.6 ref8573 1.5 ref3284 1.4 ref5838... (24 Replies)
Discussion started by: linuxkid
24 Replies

4. Solaris

Use files in place of real disc for asm

Hi I was trying to create files to be used as discs for asm configuration. I used the following steps mkdir -p /u02/asmdisks dd if=/dev/zero of=/u02/asmdisks/disk0 bs=1024k count=1000 dd if=/dev/zero of=/u02/asmdisks/disk1 bs=1024k count=1000 chown -R oracle:dba /u02/asmdisks chmod... (1 Reply)
Discussion started by: malikshahid85
1 Replies

5. Shell Programming and Scripting

shell script to replicate the log files from one location to another in real time

Hi, On the server, we have app log files in this location /app/logs/error.log On the same server, in a real time, we would like to replicate that into /var/ directory. if someone has already done this, please share the script. Thanks in advance. (4 Replies)
Discussion started by: lookinginfo
4 Replies

6. Shell Programming and Scripting

Comparing the matches in two files using awk when both files have their own field separators

I've two files with data like below: file1.txt: AAA,Apples,123 BBB,Bananas,124 CCC,Carrot,125 file2.txt: Store1|AAA|123|11 Store2|BBB|124|23 Store3|CCC|125|57 Store4|DDD|126|38 So,the field separator in file1.txt is a comma and in file2.txt,it is | Now,the output should be... (2 Replies)
Discussion started by: asyed
2 Replies

7. Solaris

Passwd,shadow files deleted and abort sequence disabled

Hi all.. I moved the /etc/shadow and /etc/shadow files to /tmp and then rebooted my PARC machine running 5.10. I did it to see if I could recover from single user mode. But, I forgot to enable the abort key-sequence which I earlier disabled. Stuck! One of my gurus told I had to... (9 Replies)
Discussion started by: satish51392111
9 Replies

8. UNIX for Advanced & Expert Users

How to find duplicates contents in a files by comparing other files?

Hi Guys , we have one directory ...in that directory all files will be set on each day.. files must have header ,contents ,footer.. i wants to compare the header,contents,footer ..if its same means display an error message as 'files contents same' (7 Replies)
Discussion started by: Venkatesh1
7 Replies

9. Shell Programming and Scripting

Comparing files in a directory against an array of files

I hope I can explain this correctly. I am using Bash-4.2 for my shell. I have a group of file names held in an array. I want to compare the names in this array against the names of files currently present in a directory. If the file does not exist in the directory, that is not a problem.... (5 Replies)
Discussion started by: BudMan
5 Replies

10. UNIX for Beginners Questions & Answers

Comparing two files and list the difference with common first line content of both files

I have two file as given below which shows the ACL permissions of each file. I need to compare the source file with target file and list down the difference as specified below in required output. Can someone help me on this ? Source File ************* # file: /local/test_1 # owner: own #... (4 Replies)
Discussion started by: sarathy_a35
4 Replies
GIT-CAT-FILE(1) 						    Git Manual							   GIT-CAT-FILE(1)

NAME
git-cat-file - Provide content or type and size information for repository objects SYNOPSIS
git cat-file (-t | -s | -e | -p | <type> | --textconv ) <object> git cat-file (--batch | --batch-check) < <list-of-objects> DESCRIPTION
In its first form, the command provides the content or the type of an object in the repository. The type is required unless -t or -p is used to find the object type, or -s is used to find the object size, or --textconv is used (which implies type "blob"). In the second form, a list of objects (separated by linefeeds) is provided on stdin, and the SHA1, type, and size of each object is printed on stdout. OPTIONS
<object> The name of the object to show. For a more complete list of ways to spell object names, see the "SPECIFYING REVISIONS" section in gitrevisions(7). -t Instead of the content, show the object type identified by <object>. -s Instead of the content, show the object size identified by <object>. -e Suppress all output; instead exit with zero status if <object> exists and is a valid object. -p Pretty-print the contents of <object> based on its type. <type> Typically this matches the real type of <object> but asking for a type that can trivially be dereferenced from the given <object> is also permitted. An example is to ask for a "tree" with <object> being a commit object that contains it, or to ask for a "blob" with <object> being a tag object that points at it. --textconv Show the content as transformed by a textconv filter. In this case, <object> has be of the form <treeish>:<path>, or :<path> in order to apply the filter to the content recorded in the index at <path>. --batch Print the SHA1, type, size, and contents of each object provided on stdin. May not be combined with any other options or arguments. --batch-check Print the SHA1, type, and size of each object provided on stdin. May not be combined with any other options or arguments. OUTPUT
If -t is specified, one of the <type>. If -s is specified, the size of the <object> in bytes. If -e is specified, no output. If -p is specified, the contents of <object> are pretty-printed. If <type> is specified, the raw (though uncompressed) contents of the <object> will be returned. If --batch is specified, output of the following form is printed for each object specified on stdin: <sha1> SP <type> SP <size> LF <contents> LF If --batch-check is specified, output of the following form is printed for each object specified on stdin: <sha1> SP <type> SP <size> LF For both --batch and --batch-check, output of the following form is printed for each object specified on stdin that does not exist in the repository: <object> SP missing LF GIT
Part of the git(1) suite Git 1.7.10.4 11/24/2012 GIT-CAT-FILE(1)
All times are GMT -4. The time now is 03:52 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy