Computing.Net > Forums > Unix > Search for file within shell

Computing.Net: Over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to sign up now, it's free!

Search for file within shell

Reply to Message Icon

Original Message
Name: hismail
Date: June 17, 2005 at 06:27:18 Pacific
Subject: Search for file within shell
OS: Sco Openserver
CPU/Ram: 2 gig
Comment:

Hi I have a script that searches for the last file modified & runs two differnt commandeds to apend to another file.
I have aproblem with my find as it cannot find the file if I run the script from the parent directory.

#!/bin/ksh
LOG=`ls -lt day*.log|grep "^-" |head -1 |awk '{print $NF}'`
STARTFILE=`head -6 $LOG >/tmp/HOME`
ENDFILE=`tail -l |grep Logfile $LOG>>/tmp/HOME`
for f in $(find /home/sing* -type f -name $LOG);do
cd $(dirname $f);$STARTFILE;$ENDFILE;cd -
done


Report Offensive Message For Removal








Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home








Do you have your own blog?

Yes
No
I did before
I will soon


View Results

Poll Finishes In 2 Days.
Discuss in The Lounge
Poll History




Data Recovery Software