I need to process a dirtree containing ms office files such that each file is stored as a variable and also, just the file file stem. Why? They will be using as input and output parameters for another script. For example /path/to/second_script -i filename.docx -o filename
Here's what I have so far. The problem is that the output of the find command is treated as a single word.
#!/bin/bash
for i in "$(find . -type f \( -iname "*.doc" -o -iname "*.docx" \))" ; do
out="${i%.*}"
echo "$i"
echo "$out"
# /bin/process -i "$i" -o "$out"
done
And here is the output:
./getit.docx
./get it.doc
./getit.doc
./getit.docx
./get it.doc
./getit
What's the trick to make this work?
EDIT: here is the working code; maybe other newbs will learn something 
while IFS= read -r -d '' file
do
echo "$file" "${file%.*}"
done< <(find -regex '.*\.\(ppt\|pptx\|xls\|xlsx\|doc\|docx\)' -print0)