Operating System - HP-UX
1754940 Members
2856 Online
108827 Solutions
New Discussion юеВ

Re: script to sequence log files

 
SOLVED
Go to solution
John Poff
Honored Contributor
Solution

Re: script to sequence log files

Hi,

I think I have your code working. I think the trick is around the typeset command and the octal problem mentioned. I got it to work by using another variable to calculate the number, and then setting the variable N to that number.

Something like this:

typeset -Z2 N
T=0

for F in $FILE_LIST
do
(( T=(T+1)%60 ))
N=$T
mv ${F} $DEST/${N}${F}
done


It looks like your arithmetic expression works, but not with a variable where you have the typeset for -Z2.

JP



Bharat Katkar
Honored Contributor

Re: script to sequence log files

typeset -Z2 N=
for F in $FILE_LIST
do
(( N=N+1 ))
[[ $N -gt 60 ]] && N=0
[[ $N -le 10 ]] && N="0$N"


Hope that should work.
Regards,
You need to know a lot to actually know how little you know
Vin_4
Occasional Contributor

Re: script to sequence log files

That works John, thanks!