Hi,
I'm trying to process a log file to extract the file names created. The problem I have is some of the filenames contain spaces. This line process the log:
[blue]cat /somewhere/file.log | awk 'BEGIN { FS="location " } /Processing file/ { print "\""$2"\"" }'[/blue]
This produces:
"/somepath/file 001.zip"
"/somepath/file 002.zip"
I've tried putting this in my for loop like so:
But I allways get:
Copying file "/somepath/file ....
Copying file 001.zip" ....
Copying file "/somepath/file ....
Copying file 002.zip" ....
Any idea how I can protect the filenames ? I know spaces in unix are a bad idea, but we dont have much choice.
Any hints/tips/thoughts welcome.
I'm trying to process a log file to extract the file names created. The problem I have is some of the filenames contain spaces. This line process the log:
[blue]cat /somewhere/file.log | awk 'BEGIN { FS="location " } /Processing file/ { print "\""$2"\"" }'[/blue]
This produces:
"/somepath/file 001.zip"
"/somepath/file 002.zip"
I've tried putting this in my for loop like so:
Code:
for i in `cat /somewhere/file.log | awk 'BEGIN { FS="location " } /Processing file/ { print "\""$2"\"" }' `
do
echo "Copying file $i ...."
done
But I allways get:
Copying file "/somepath/file ....
Copying file 001.zip" ....
Copying file "/somepath/file ....
Copying file 002.zip" ....
Any idea how I can protect the filenames ? I know spaces in unix are a bad idea, but we dont have much choice.
Any hints/tips/thoughts welcome.