Need to count files & create log of that.


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Need to count files & create log of that.
# 1  
Old 07-01-2011
Need to count files & create log of that.

Hi Friends,
I need some help. First look at my files hierchachy

Code:
/<level-1>/<level-2>/<level-3>/*.tif

eg. :

Code:
/2010-07-01/AFFIDAVIT-OF-SERVICE---FOR-SC/001/Babylon2_20100701012049_1278004849.49892_000.tif
./2010-07-01/AFFIDAVIT-OF-SERVICE---FOR-SC/002/Babylon2_20100701012049_1278004849.49892_016.tif
./2010-07-01/AFFIDAVIT-OF-SERVICE---FOR-SC/003/Babylon2_20100701012049_1278004849.49892_035.tif
./2010-07-01/AFFIDAVIT-OF-SERVICE---FOR-SC/004/Babylon2_20100701012049_1278004849.49892_046.tif
./2010-07-01/AFFIDAVIT-OF-SERVICE---FOR-SC/005/Babylon2_20100701012049_1278004849.49892_058.tif
./2010-07-01/AFFIDAVIT-OF-SERVICE---FOR-SC/006/Babylon2_20100701012049_1278004849.49892_078.tif
./2010-07-01/AFFIDAVIT-OF-SERVICE---FOR-SC/007/Babylon2_20100701012049_1278004849.49892_096.tif
./2010-07-01/AFFIDAVIT-OF-SERVICE---FOR-SC/008/Babylon2_20100701012049_1278004849.49892_105.tif
./2010-07-01/AFFIDAVIT-OF-SERVICE---FOR-SC/009/Babylon2_20100701012049_1278004849.49892_117.tif

I want to find out the list of level-3 folders, which contain more that 2 TIF images. I want list of full path from date to that tif image.

Last edited by pludi; 07-01-2011 at 04:20 AM..
# 2  
Old 07-01-2011
Something like this..?
Code:
awk -F"/" 'NR==FNR{++a[$4];next} a[$4]>2 {print}' inputfile inputfile

# 3  
Old 07-01-2011
Try this..
Code:
% awk -F"/" ' { print $4 } ' input_file | uniq -c | grep -v "1" | awk ' { print $2 }' | sed 's,^,grep \"/,g;s,$,/\" input_file,g' | sh

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Error files count while coping files from source to destination locaton as well count success full

hi All, Any one answer my requirement. I have source location src_dir="/home/oracle/arun/IRMS-CM" My Target location dest_dir="/home/oracle/arun/LiveLink/IRMS-CM/$dc/$pc/$ct" my source text files check with below example.text file content $fn "\t" $dc "\t" $pc "\t" ... (3 Replies)
Discussion started by: sravanreddy
3 Replies

2. Shell Programming and Scripting

Parse Log & Create Flow Diagram - Ideas/Tools

Hi, I would like to develop a script which parses the log file and generates a flow diagram ( graphical display ). We have an application, for understanding the sequence of functions call made, we have an debug line at "ENTRY/EXIT" of function. I have a small log parsing script which grep the... (2 Replies)
Discussion started by: ennstate
2 Replies

3. UNIX for Dummies Questions & Answers

Need to create 2 log files

Hello, and thanks upfront for looking! I've been searching the threads for a way to do this, and have come up empty. Then again I don't seem to use the right search criteria... We have a driver script which logs output to files which are used to be viewed via an online scheduling tool:... (5 Replies)
Discussion started by: peteroc
5 Replies

4. Linux

Create folder by script & move files in it

Hi Team, I have over 1 lakh pdf files. I want to create folders like Disk-1, Disk-2 ..... & want to move 3000 pdfs per folder. Can i do it by script? Please help me. Thanks & Regards Parag Nehete (4 Replies)
Discussion started by: paragnehete
4 Replies

5. Homework & Coursework Questions

shell script that can create, monitor the log files and report the issues for matching pattern

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Write an automated shell program(s) that can create, monitor the log files and report the issues for matching... (0 Replies)
Discussion started by: itian2010
0 Replies

6. Shell Programming and Scripting

Write an automated shell program(s) that can create, monitor the log files and report the issues for

Hi , Please help me getting this done. Write an automated shell program(s) that can create, monitor the log files and report the issues for matching pattern. (i) Conditions for creating log files. Log file is created with date (example 2010_03_27.log). If the log file size is 10 Mb for... (1 Reply)
Discussion started by: itian2010
1 Replies

7. Shell Programming and Scripting

Help to create a script to parse log files

Hello everybody, I need some help here to create a script to parse a log file. Here is a sample of the log file : 0x42258940 (Debug) Cache SUMMARY attrs now/668 min/668 max/668. 0x42258940 (Debug) RSVD SUMMARY reserved space max requested/128 MB accounted now/0 MB 0x42258940 (Debug)... (12 Replies)
Discussion started by: Samb95
12 Replies

8. Shell Programming and Scripting

Read multiple log files and create output file and put the result

OS : Linux 2.6.9-67 - Red Hat Enterprise Linux ES release 4 Looking for a script that reads the following log files that gets generated everynight between 2 - 5am Master_App_20090717.log Master_App1_20090717.log Master_App2_20090717.log Master_App3_20090717.log... (2 Replies)
Discussion started by: aavam
2 Replies

9. Shell Programming and Scripting

taking count of log files and den performing some actions

hi, I've some log files in a path /SYSTEM/custom/data/MNP/xmlerror as: MNP_PORT_IN_P200902191347563283_20090220181630_err_1.xml MNP_PORT_IN_P200902171717114365_20090220211814_err_2.xml MNP_PORT_IN_P200902191349023233_20090220181923_err_1.xml... (4 Replies)
Discussion started by: ss_ss
4 Replies

10. UNIX for Dummies Questions & Answers

Monitoring & emailing log files

Hi ..first post ! I have a Unix v445 using solaris 10. I've trolled through various web pages but can't find exactly what I'm looking for. I have an alert log...or any messages file for that matter I need to check for certain key (error type) phrases - if I find them, they are redirected to... (11 Replies)
Discussion started by: davidra
11 Replies
Login or Register to Ask a Question