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

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Search for file within shell

Reply to Message Icon

Name: hismail
Date: June 17, 2005 at 06:27:18 Pacific
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



Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


A simple script for creat... process generate the most...



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


Sponsored links

Ads by Google


Results for: Search for file within shell

search for files & directories www.computing.net/answers/unix/search-for-files-amp-directories/4600.html

Help: how do i search a file? www.computing.net/answers/unix/help-how-do-i-search-a-file/4660.html

Search Large Files www.computing.net/answers/unix/search-large-files/5311.html