![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Auto copy for files from folder to folder upon instant writing | Bashar | UNIX for Advanced & Expert Users | 2 | 08-21-2008 11:44 AM |
| How to print two sql query outputs side by side in excel | prasee | Shell Programming and Scripting | 6 | 09-07-2007 11:20 PM |
| Missing Library Files | jays337 | UNIX for Dummies Questions & Answers | 5 | 08-18-2005 05:23 PM |
| files missing | cubicle^dweller | UNIX for Dummies Questions & Answers | 4 | 09-22-2003 12:10 PM |
| Having a Unix system installed side to side with Windows? | Pcslider | UNIX for Dummies Questions & Answers | 14 | 01-29-2002 03:21 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Dear all,
Every hour i am receiving several data files to one folder for 24 hours each day.But some times some hours i do not have the files because of some problem.So i want to check the files inside the folder at the end of the day wether how many files i received in each hour like this.so i know if the files are missing , since missing hour files received is zero. results should be like this, 00 hour - 15 files 01 housr - 14 files 02 hour - 10 files - - 23 hour - 5 files can some help me to write a script for this ? Nayanajith. |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
what is the filenaming convention ?
or they created based on the hour they are created ? if they are not modified, with the access time (which would be the same as creation time) also we can generate a requested list |
|
#3
|
|||
|
|||
|
Quote:
reply They are created based on the hour. eg, Jun 22 23:12 0622.IST230500.00.pp_20060622_231252 Jun 22 23:22 0622.IST231000.00.pp_20060622_232223 Jun 22 23:22 0622.IST231500.00.pp_20060622_232252 Jun 22 23:42 0622.IST233500.00.pp_20060622_234252 Jun 22 23:52 0622.IST234000.00.pp_20060622_235222 Jun 23 00:02 0622.IST234500.00.pp_20060623_000252 Jun 23 00:03 0622.IST235000.00.pp_20060623_000322 Jun 23 00:12 0623.IST000000.00.pp_20060623_001252 Jun 23 00:22 0623.IST001000.00.pp_20060623_002222 so i have 5 files on 22nd and i have 4 files on 23rd. Result should be, Jun 22 23 hour - 5 files Jun 23 00 hour - 4 files. so i want a script get above result. Thanks. |
|
#4
|
|||
|
|||
|
Try this
>ll * |grep Jun |grep 22 |grep 23: |wc -l above cmd will give you number of files created on Jun 22, 23hours. You can replace * with the file name pattern for specific files. |
|
#5
|
|||
|
|||
|
Hi Naynajith
I am not sure is this one exctly you want. Any way hope that at least it will help you derive what you are looking for. Here is the script I tried and as per my understanding of your question, it works!!! #/bin/ksh for i in "00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "20" "21" "22" "23" do count=`ls -l | grep " $i " | nawk -v arg="$1" '{if(index($8,arg) == 1) print $0' | wc -l` echo "Hour $i - $count File(s)" done The script accepts the date as runtime argument. For example I saved it as t.sh, then I did run the script as follows to get the report for Jun 26 $t.sh "Jun 26" Hope it helps you!! |
|||
| Google The UNIX and Linux Forums |