I need your help please.
i have a function which has an input file called lista1 and the format is this:
lista1:
01/09/2006
01/09/2006
01/09/2006
01/09/2006
01/09/2006
01/09/2006
01/09/2006
01/09/2006
01/09/2006
01/09/2006
01/09/2006
01/09/2006
01/09/2006
01/09/2006
01/09/2006
02/08/2006
i tried to modify the records to direct to list2 but the output from this file lista2 is:
1/8/2006
1/8/2006
1/8/2006
1/8/2006
1/8/2006
1/8/2006
1/8/2006
1/8/2006
1/8/2006
1/0.00398804
1/0.00398804
1/0.00398804
1/0.00398804
1/0.00398804
1/0.00398804
1/0.00398804
1/0.00398804
1/0.00398804
1/0.00398804
1/0.00398804
1/0.00398804
1/0.00398804
1/0.00398804
1/0.00398804
1/0.00398804
1/0.00398804
1/0.00398804
1/0.00398804
Ptroduce strange records.
Why:
I just want to less one day ie if the record from lista1 is 04/08/2006, i want this record could become in lista2 03/08/2006
If you just want to less one day from your record, why don't you try Perderabo's datecalc , here is one dirty code for the requirement mentioned by you:
Input:
Output:
Above code works little slow, maybe someone else could come up with some faster code.
Regards,
Tayyab
Thanks a lot Perederabo, it is a great and a useful script, i just have a question if you dont mind. Could you explaine me line por line what thos shell is doing, ive triing to grasp but to be perfectly honest i dont understand. the code is this:
typeset -Z2 month2 day2
while IFS=/ read day month year; do
set +A a $(./datecalc -a $year $month $day - 1)
day2=${a[2]}
month2=${a[1]}
echo ${day2}/${month2}/${a[0]}
done < lista1 >lista2
exit 0
Thanks a lot again.