I have a script that works great but in that script I am using grep to extract two lines
grep -e "string1" -e "string" my_fliles* >> //destination
The output of that looks good
filename1 string1
filename1 string2
filename2 string1
filename2 string2
filename3 string1
filename3 string2
That is the desired effect but in order to get it to work in a cron job I have to specify the full path to my_files
grep -e "string1" -e "string" /home/username/scriptfolder/logs/my_fliles* >> //destination
That creates output like
/home/username/scriptfolder/logs/filename1 string1
/home/username/scriptfolder/logs/filename1 string2
/home/username/scriptfolder/logs/filename2 string1
/home/username/scriptfolder/logs/filename2 string2
/home/username/scriptfolder/logs/filename3 string1
/home/username/scriptfolder/logs/filename3 string2
I want the filenames and the string outputs but not the path. I tried removing the path and specifying the path in the script with
export PATH=$PATH:/home/username/scriptfolder/logs/
but that did not work. anny suggestions?