Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Still can't get this to work:
This is what I am trying to do1) The fist file I am looking for is in this directory:
xnet-stc/int/exe_inbound/history
(There will always be a file)
The search term would be exe_act*.dat with the current days timestamp only.
Otherwise it will pick up all the exe_act* files in the history directory.
I do a word count on it to get the number of lines only and put that into a variable.
2) The next 3 files are in the directory
stc-sap/int/exe_inbound
so I need to change the path(which is not a problem so far)3) Then I need to do a word count for number of lines only on
exe_gr*.tmp
exe_rtv*.tmp
exe_invadj*.tmp
and put those into variables(or one variable?)********The problem here is there are days when not all three files will be there so I
need to do a find first I guess and return a count of zero, or return nothing if the
file is not there. (initialize to zero?)*********Then I need to add the wordcount from the 3 files(or1 or 2, whatever is there) and put into
a variable(or whatever is easiest)Then I need to compare the wc in the variables from step 1 and step 3.
If they match, exit and end.If they do not match:
delete
exe_gr*.tmp
exe_rtv*.tmp
exe_invadj*.tmp
(that is ok since I am in that directory still)Then I would need to move up to xnet-stc/int/exe_inbound/history
and somehow take the exe-act*.dat file that I did the wordcount on and
move it up one directory to xnet-stc/int/exe_inbound and rename the file
extension from .dat to .tmp
Then exit and endI seem to be having a problem with the move
I can get it to delete the other files but that's it!Can anyone help? I thought this would be simple for me but I guess I am such a beginner that it is making me crazy!
Thank in advance

cd xnet-stc/int/exe_inbound/history
echo "Displaying list of activity files for DC4"TEST=`find exe_act_0004* -mtime -1`
echo $TESTread ANS?
ACT=`wc $TEST | cut -c7-12`
echo $ACTecho "==========================="
cd
cd stc-sap/int/exe_inbound/echo "Displaying Word Count for Goods Receipt File"
wc exe_gr*.tmpecho "Displaying Word Count for RTV File"
wc exe_rtv*.tmpecho "Displaying Word Count for Inventory Adjustment File"
wc exe_invadj*.tmp
read ANS?GR=`wc exe_gr*.tmp | cut -c5-11`
echo $GRRTV=`wc exe_rtv*.tmp | cut -c5-11`
echo $RTVINV=`wc exe_invadj*.tmp | cut -c5-11`
echo $INVlet A=GR+RTV+INV
echo "============================================="
echo $A
echo "Do the files sizes match?"
read A ACTif [ A = ACT ]
then
echo "Yes,the file sizes match"
#exit 0elif [ A != ACT ]
then
echo "No, the file sizes don't match."
echo "Do you wish to re-process?"echo "Input y for yes or n for no:\c"
read answer
if [ answer=Y ]
then
rm exe_gr*.tmp
rm exe_rtv*.tmp
rm exe_invadj*.tmp
cd
cd xnet-stc/int/exe_inbound/history
mv $TEST .. /exe_act_0004.tmp
else
echo "Goodbye"
#exit 0
#fi
fi
fi

Your whole script required to be rewritten.
Nothing seems to be okay in it will require time.Will try to do it in next sitting.

![]() |
![]() |
![]() |

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