I have part of my script that goes like this:
while read line
do
code=`echo ${line} | awk '{print $1}'`
awk -f ${supscript}/rearrange.sh < ${base}/${code}
mv temp_output* "$code"temp_output*
done < filelist
The script is working; the only problem is that when it is trying to rename the file I got the following error message:
mv: target `pollcodetemp_output*' is not a directory
Maybe it is something related with the IFS. I try to specify this at the beginning of the script as:
IFS='
'
But it is not working. I’m using a Windows text editor but I have already removed the CR.
Most likely, you just need:
This will move the files named
temp_output*in the current directory to the directory specified in the variable$code.However, if
$codeis a file, then you need to look for arenamecommand (there are several versions, with different syntaxes), or you need to use an inner loop: