![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Small Search script | appu1987 | Shell Programming and Scripting | 2 | 06-03-2008 07:14 PM |
| script to search a file | dr46014 | Shell Programming and Scripting | 1 | 02-28-2008 02:55 AM |
| Search File Script | I4ce | Shell Programming and Scripting | 7 | 03-28-2006 11:12 AM |
| Search script | BCarlson | Shell Programming and Scripting | 14 | 02-04-2006 10:50 PM |
| script to search all the directories | abk | Shell Programming and Scripting | 3 | 07-09-2002 09:19 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
Help with search script
HI all,
I am trying to find files that have .cc3 file extenstion folder using this script below, but this fails as there are files in the folder and i get a message saying i have no files. Please anyone reveiw and let me know if i am missing anything.I am working on this from two days and i don't know where i have gone wrote. I would be gratefull for any help on this ##!/usr/bin/sh -x ##Initialising variables FROM_DIR=/disk1/sandeep/cc3/perry; export FROM_DIR LOG_DIR=/disk1/sandeep/log/perry; export LOG_DIR echo "COSTING CC3 FILE Check started........................................" > $LOG_DIR/perry.log echo " " >> $LOG_DIR/perry.log cd $FROM_DIR check=`ls|grep cc3|wc -l` if [ $check -ne 0 ] then echo "INPUT FILE NOT FOUND FOR TODAY................................" > $LOG_DIR/errorperry.log echo " " >> $LOG_DIR/errorperry.log echo " " >> $LOG_DIR/errorperry.log echo "Please verify the reason for the FAILURE....................." >>$LOG_DIR/errorperry.log echo " " >> $LOG_DIR/errorperry.log echo " " >> $LOG_DIR/errorperry.log echo "EXITING FROM PROCESS..............................................................." >>$LOG_DIR/errorperry.log cd $LOG_DIR cat /disk1/stonehs1/log/perry/errorperry.log|mailx -s "ALERT-NO FILE FOUND" `cat maillist` exit 1 else echo "INPUT FILE FOUND FOR TODAY...................................." >> $LOG_DIR/perry.log echo " " >> $LOG_DIR/perry.log echo "NUMBER OF RECORDS IN INPUT FILE STarts.............................." >> $LOG_DIR/perry.log echo " " >> $LOG_DIR/perry.log echo " " >> $LOG_DIR/perry.log wc -l *.cc3 >> $LOG_DIR/perry.log echo " " >> $LOG_DIR/perry.log echo " " >> $LOG_DIR/perry.log echo " " >> $LOG_DIR/perry.log cat /disk1/stonehs1/log/perry/perry.log|mailx -s "ALERT-FILE FOUND" `cat maillist` exit 0 thanks, Sandeep |
| Forum Sponsor | ||
|
|
|
|||
|
Hi kamitsin,
I have made the change now and it is working. Thanks for your help . i would like to know how i can find the .cc3 files by making a change in this command in the script: `ls|grep cc3|wc -l` i tried changing it to `ls|grep *.cc3|wc -l` but it did not work Please let me know. Thanks, Sandeep |
|
|||
|
Quote:
Code:
ls -al *.cc3|wc -l |
|
|||
|
You can use following one liner command to find the file of given name/ext.
find Directory -type f -name "*.CC3" -print Directory could be fixed or given by the user. Hope it would help !! |
|
||||
|
can you try this one,
check=`find . -type f -name "*.cc3" -print | wc -l` NOTE: "." is the current dir , instead you can use your own search dir . Last edited by manas_ranjan; 09-05-2007 at 01:41 AM. Reason: added note |
||||
| Google The UNIX and Linux Forums |
| Thread Tools | |
| Display Modes | |
|
|