No. The 'listOfFilesFile' is the name of the file containing the filenames you'd like to 'spawn' your 'temp' file to.
Am I missing something in your original request?
Ah...sorry I think I was a bit unclear.
My goal is to take a file with name "file.a.b.c-d.r" and produce 4 exact copies of it with 4 different names:
"file.a.b.1-A.r"
"file.a.b.1-B.r"
"file.a.b.1-C.r"
"file.a.b.1-D.r"
all the while, being able to "feed" the four new variables A, B, C, D I name within the bash script.
something along these lines...
remove the 'echo' when satisfied with the results.
#!/bin/ksh
temp='~/file.a.b.c-d.r'
vars='A B C D'
for var in ${vars}
do
a="${temp%-*}"
a="${a%.*}"
a="${a}.1-${var}.${temp##*.}"
echo cp "${temp}" "${a}"
done
there's a "for-loop"
a. I guess now I have to familiarize myself with variable assignment and regular expreession matching to figure out what is going on within the curly brackets and with the "%" and "-" characters.
After taking off the "echo" command and assigning the the right path, it does spit out the 4 files I wanted...
Thanks again for your help!
OK so I figured out what each part of that little script in the for loop (along with why you use curly brackets when calling a variable)
a="${temp%-*}" ##cuts everything after the c off of the name of temp b/c using remainder command
a="${a%.*}" ##cuts the ".c" part.....though I'm not sure why this was needed since you could've just cut it in the first assignment of a by cutting before the "-"
a="${a}.1-${var}.${temp##*.}" ##calls for a adds "a .1-" then each of the variables {A B C D} but the last part has be stumped
${parameter%word}
Remove Smallest Suffix Pattern. The word will be
expanded to produce a pattern. The parameter expansion
then will result in parameter, with the smallest por-
tion of the suffix matched by the pattern deleted.
${parameter%%word}
Remove Largest Suffix Pattern. The word will be
expanded to produce a pattern. The parameter expansion
then will result in parameter, with the largest por-
tion of the suffix matched by the pattern deleted.
${parameter#word}
Remove Smallest Prefix Pattern. The word will be
expanded to produce a pattern. The parameter expansion
then will result in parameter, with the smallest por-
tion of the prefix matched by the pattern deleted.
${parameter##word}
Remove Largest Prefix Pattern. The word will be
expanded to produce a pattern. The parameter expansion
then will result in parameter, with the largest por-
tion of the prefix matched by the pattern deleted.
Given the above description, try to work out the mechanics with a sample input.
and tee splits the output of the original file to all the files listed. The second case uses cat to display the file and pipe it to tee, the first case just uses the contents of the file as input for tee.