The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to use datecalc for adding hours ucbus UNIX for Dummies Questions & Answers 5 06-03-2008 01:48 PM
datecalc question. trey85stang Shell Programming and Scripting 4 05-08-2008 06:20 PM
datecalc tostay2003 Shell Programming and Scripting 1 08-21-2007 07:20 AM
Help on runing a script mig28mx UNIX for Dummies Questions & Answers 1 01-06-2006 01:24 PM
runing a script as superuser bcheaib UNIX for Dummies Questions & Answers 2 07-06-2004 10:24 PM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-21-2007
Registered User
 

Join Date: Sep 2006
Posts: 30
Cool 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
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 02-21-2007
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,452
This line is wrong:
set +A a $(datecalc -a $year $month $day -1)
You need a space between the minus sign and the 1... like this:
set +A a $(datecalc -a $year $month $day - 1)
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 03:04 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0