02-21-2007
Need a help Please- runing the perderabos script datecalc
i have a script in bourne called cdrsnokia.sh and inside of it calls a script called resta_dias where it calls the datecalc script (perderabos date calculator).
The purpose is to rest (-) one day arithmetical operation the content of each line and the result is passed to another file lista2;after that, i have to make a report how many lines there are per line ie:
day number
01 4
02 2
lista1 has this structure:
lista1
02/01/2007
02/01/2007
02/01/2007
02/01/2007
03/01/2007
04/01/2007
04/01/2007
05/01/2007
05/01/2007
output should be:
lista2
01/01/2007
01/01/2007
01/01/2007
0/01/2007
02/01/2007
03/01/2007
03/01/2007
04/01/2007
04/01/2007
The real problem is that the script generates the file lista2, in base of this file i couild use grep to count the lines per day, but the the lines in lista2 are in blank.
$more lista2
//
//
//
//
//
//
//
//
As you can see above ths script datecalc is runnind but the values of the fields are in blank.
I was using a former script qith awk, it was working but its too sloowly.
I would apreciate hugly your help.
my work experience is in bourne but no korn shell.
Here i attach the scripts. (i dont attach the datecalc perderabos calculator)
cdrsnokia.sh
ajusta_fecha()
{
cut -f1 -d " " listacdrs|sort -t/ -k2 > lista1
valida=`cut -f2 -d "/" lista1|uniq|grep -v $mes lista1|uniq`
if [ $? -eq 0 ]
then
resta_dias
else
}
resta_dias
#!/bin/ksh
#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
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
1. Do I need syslog running in my services?
2. Is there such a critter for counterstrike installer for linux or do i need to use winex (2 Replies)
Discussion started by: amicrawler2000
2 Replies
2. UNIX for Dummies Questions & Answers
My first post:
in /etc/rc2.d i have a startup script: Script1.
if you run #>scirpt1 stop/start from any user other than root you will get u must be supper user to run this script. eventhough the rights are 777.
Question: how can i get my user_a be able to run this script to stop and start it... (2 Replies)
Discussion started by: bcheaib
2 Replies
3. UNIX for Dummies Questions & Answers
:confused: Hello group,
Let me explain a little,
I´m running under HP UX 11.i SO. I need to put on the server via FTP a file with the following attributes: -r--r--r-- this is read for all.
Also I tried using inet.conf to change the umask for ftp and works perfect on giving the permissions for... (1 Reply)
Discussion started by: mig28mx
1 Replies
4. Shell Programming and Scripting
Is there no simple way using 'date' command just to get number of days from given date.
ie. if I pass 2007-01-15 as an argument. I want to obtain result as 015
Simarly for 2007-02-10. I want to obtain result as 41.
Can't this be achieved by simple 1 or 2 lines of command (date). As this is... (1 Reply)
Discussion started by: tostay2003
1 Replies
5. Shell Programming and Scripting
I have a script that works perfectly on a linux box, but I am going to have to move it over to solaris which I have never really worked with. I was a bit miffed that date -d was not available on solaris so I started looking for alternative soltuoins and found this forum and datecalc.
But I... (4 Replies)
Discussion started by: trey85stang
4 Replies
6. UNIX for Dummies Questions & Answers
Hello:
I need to generate two datetimestamps in one hour apart.
the start date is 05262008000000
then generate the following dates
05262008010000
05262008020000
05262008030000
... ... ...
... ... ...
05262008230000
05272008000000
05272008010000
05272008020000
05272008030000
...... (5 Replies)
Discussion started by: ucbus
5 Replies
7. UNIX for Dummies Questions & Answers
I have a doubt in date conversion. Can anyone explain the logic behind the date2jd and jd2date in datecalc function specified in this forum. I could not understand what the number are actually representing. Please explain...bcoz i am doing a program with this one..
Note: No need to... (1 Reply)
Discussion started by: sivakumar.rj
1 Replies
8. Shell Programming and Scripting
i have bash script with some batches, and when i putt log level 4 in script i get error while executing or if i rung script.sh with parameter log level 4.
i appriciate some advice :) (3 Replies)
Discussion started by: unknown1
3 Replies
9. Shell Programming and Scripting
Hi guys.
I am trying to subtract 10 minutes from the current Unix system date and time. I have the datecalc provided here but it is mainly the date and not the time. Please check on how can i subtract 10 minutes from the current time using datecalc or any other shell scripting that will... (2 Replies)
Discussion started by: bantiloe
2 Replies
10. Shell Programming and Scripting
While running the script it is failing while searching the pattern if the pattern is found then it is running fine if the pattern is
not found it terminate with error my requirement is if the pattern is not found then it exit successfully.
cat $INTE/CTY_${DATE}_cn_ar.*|cut -c 1-100|grep... (3 Replies)
Discussion started by: jagu
3 Replies