Need good solution


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Need good solution
# 1  
Old 11-20-2008
Need good solution

Hi all

I have a script that run fine ,Actually if find 777 directory and take its count and report,There is no problem with the script.But our reporting system have some limitation that dont allow more then 1000 directory to report,Now i want some way i can break this up and then report to the reporting system,My code is below,At the moment there are like 5000 777 directories.Please help i am blanked.


Code:
#!/bin/bash

check=/var/www/html


res=$(find $check -type d -perm 777 2>/dev/null )
count=$(find $check -type d -perm 777 | wc -l)

echo $count
#echo $res
                   
Reporting system command.

# 2  
Old 11-20-2008
Need good slotuion

Code:
#! /bin/bash

TD=$(mktemp -d /tmp/xxxxxxxxx)
ALL="${TD}/allfiles"
REP=<Reporting system command>
trap "rm -Rf ${TD}" 0 1 2 3 9 13 15

cd ${TD}
find /etc -type f > ${ALL}
split -l 100 ${ALL} "prfx-"
find . -name "prfx-*" -exec ${REP} {} \;

exit 0

# 3  
Old 11-20-2008
HI

I think this will work,Its good if you explain how and what is going on
# 4  
Old 11-21-2008
some comments

Code:
#! /bin/bash

TD=$(mktemp -d /tmp/xxxxxxxxx)         # create a temp-directory
ALL="${TD}/allfiles"                               # a filename for the output of find
REP=<Reporting system command>    # your command
trap "rm -Rf ${TD}" 0 1 2 3 9 13 15       # erase the temp directory at signal 0,1 etc.

cd ${TD}
find /etc -type f > ${ALL}                        # find and put all output in one file
split -l 100 ${ALL} "prfx-"                       # split this file into smaller files with 100 
                                                              # lines each (filenames start with "prfx-")
find . -name "prfx-*" -exec ${REP} {} \;  # find the "prfx-"-files and call your 
                                                              # command with them (I don't know
                                                              # how your command works)

exit 0

# 5  
Old 11-21-2008
HI

This is not working Dear,Can anyone post simpler and nicer solution.
Login or Register to Ask a Question

Previous Thread | Next Thread

2 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

need the solution

Write a program to print all prime numbers from 1 to 300. (3 Replies)
Discussion started by: paniruddha
3 Replies

2. UNIX for Dummies Questions & Answers

Need an urgent solution

Hi guys , I think i have completely lost touch with awk ... but now i need it deseparatly ... my problem is for each line in the line i have to check if the first 2 charactes are 'A4' and if they are 'A4' then cut the characters from position 11-16 from that line ... In the meantime i... (1 Reply)
Discussion started by: myelvis
1 Replies
Login or Register to Ask a Question