Hi all,
I am going slightly insane about this because I have been spending a lot of time on this simple thing and I am not sure what is wrong. I just want to rename a couple files that are time and date stamped to something that I can easily read into my python program. Anyway the original file has a format as follows:
i5r07_9hst-p00_2011-01-30_15-32-23.71.data
i5r07_9hst-p01_2011-01-30_15-32-23.82.data
I would want to rename them as follows:
i5r07hstp00.dat
i5r07hstp01.dat
Where p keeps changing according to the data channel. At the moment I have this:
#!/bin/tcsh
set D=`date +%Y-%m-%d`
cd $HOME/Users/riedel/iceanalysis
set i=0
while ($i<12)
if ($i<10) then
set p=p0$i
mv $1$2_9hst-${p}_${D}*.data $1$2hst${p}.dat
else
set p=p$i
mv $1$2_9hst-${p}_${D}*.data $1$2hst${p}.dat
endif
set i=$i
@ i++
end
What happens is that the mv command demands a folder as the destination. The sanem thing happens when i use cp, which would be fine as well.I have read the man page and have googled my fingers off and cant find a solution to the problem.
If there is some niffty way in python to do this. I would be open to that as well
I need to do this in teh tcsh shell because the computer is setup really weirdly.
Thanks a lot in advance for any input here.