![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Small Search script | appu1987 | Shell Programming and Scripting | 2 | 06-03-2008 10:14 PM |
| script to search a file | dr46014 | Shell Programming and Scripting | 1 | 02-28-2008 06:55 AM |
| Search File Script | I4ce | Shell Programming and Scripting | 7 | 03-28-2006 02:12 PM |
| Search script | BCarlson | Shell Programming and Scripting | 14 | 02-05-2006 02:50 AM |
| script to search all the directories | abk | Shell Programming and Scripting | 3 | 07-10-2002 12:19 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | 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 |
|
||||
|
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 !! |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|