Several of us are trying to help you in this thread, but when we ask questions that will help us help you you show us a different copy of your code instead of answering the questions. We haven't seen your input files. We haven't seen the filesystem hierarchy you're using or the files you're trying to copy and whether or not the destination directory already contains files with those names. You have two different counts of successful and failed copies and have refused to show us why this matters in the output you want to produce. You have not explained why non-existent destination directories should be treated as failed copies instead of creating the missing directories.
I am guessing that you are using some type of Linux system (since you're using
gawk instead of
awk), but, of course,
gawk can be installed on non-Linux systems). And, you haven't told us what shell you're using.
You are using
$* in your code, but you have never given us any indication of what operands you are passing to your script when you invoke it. (So there is no way for us to understand what you're trying to do nor for us to guess at how your code is going to behave.)
Please help us help you!
Please answer the following questions. Without answers to these questions, I don't think we're going to be able to help you get the results you want.
- What operating system are you using?
- What shell are you using?
- What is the name of your shell script?
- What arguments do you pass to your shell script when you invoke it?
- What output do you get from your shell script?
- What output do you want to get from your shell script?
- Have you tried tracing your script as you run it? If not, why not? Examining the trace output from a shell script is usually an easy way to see where things are going wrong and identify areas that need to be fixed! Add set -xv to your script and show us the tracing output you get when you run your script.
- After running your script what are the contents of the file XmlDataNew.txt?
- After running your script what are the contents of the file Test4.txt?
- What are the contents of the .xml file that you processed with this invocation of your shell script?
- Assuming that you are using a recent version of bash or ksh as your shell; what output do you get if you run the script RudiC provided in post #15 in this thread?