awk scripts problem after upgrade from RHEL-2.1 to RHEL-4
Waleed Harbi
waleed.harbi at gmail.com
Sun May 14 16:32:41 UTC 2006
Try to add this option set -x in your script "second line" to debug it and
check for the syntax may be some one change something , set -x will help
you.
On 5/12/06, Ben Russo <ben at muppethouse.com> wrote:
>
> We had two almost identical servers running RHEL-2.1
> One of them we upgraded to RHEL-3, then to RHEL-4 (in a two stroke
> process).
>
> up2date -u
> boot from rhel-3 cd#1,
> boot: linux upgrade
> default options all the way
> reboot
> up2date -u
> boot from rhel-4 cd#1
> boot: linux upgrade
> default options all the way
> reboot
> up2date -u
>
> Now the second server (which was working fine yesterday) is RHEL-4
> and old legacy accounting scripts don't work.
>
> A regular user on the system has a script called "idxlist"
> it is:
>
> [ -z "$LOCAL" ] && LOCAL=/u/apps/utilities
> awk -f$LOCAL/idxlist.awk -v date=$1 -v ext=$2 $LOCAL/idxpath
>
> idxlist.awk's contents look like this:
>
> BEGIN {
> dash=index(date,"-")
> plus=index(date,"+")
> if (dash!=0)
> {
> range=1
> beg=substr(date,1,dash-1)
> end=substr(date,dash+1)
> if (length(end)<6)
> end=substr(beg,1,6-length(end)) end
> }
> else if (plus!=0)
> {
> sequence=1
> beg=substr(date,1,plus-1)
> count=substr(date,plus+1)+0
> }
> else {
> singular=1
> }
> if(ext!="")
> ext="." ext
> }
> /^\*/ {next}
> singular && substr(date,1,4)==$1 {
> look=1
> # NF=0
> "ls " $2 "arc" date "*" | getline
> if (NF==0)
> print 0
> else print substr($1,1,length($1)-4) ext
> next
> }
> sequence==1 {
> while("ls " $2 | getline file)
> {
> look=1
> arc=(substr(file,1,3)=="arc")
> nam=index(file,"arc")
> #dat=substr(file,nam+3,6)+0
> dat=substr(file,nam+3,6)
> if (dat==beg&&start==0)
> start=1
> if (arc && start && start<=count)
> {
> if (found[dat]==0)
> {
> print $2
> substr(file,1,length(file)-4) ext
> start++
> }
> found[dat]=1
> }
> }
> next
> }
> range==1 {
> while("ls " $2 | getline file)
> {
> look=1
> nam=index(file,"arc")
> #dat=substr(file,nam+3,6)+0
> dat=substr(file,nam+3,6)
> if (dat>=beg && dat<=end)
> {
> if (found[dat]==0)
> print $2
> substr(file,1,length(file)-4) ext
> found[dat]=1
> }
> }
> }
> END {
> if (look==0)
> print 0
> }
>
> ###### END OF IDXLIST.AWK
>
> That would seem pretty simple.
> The script just takes a date in the form of 060512 or 060507+5 or
> 060512-11
>
> and it would give you a list of files in the directories that are listed
> in /u/apps/utilities/idxpath that contain the date string in the range
> given.
>
> It works fine on server 1 (RHEL-2.1) but not on the upgraded server
> (RHEL-4)
>
> any ideas?
>
> -Ben.
>
> --
> redhat-list mailing list
> unsubscribe mailto:redhat-list-request at redhat.com?subject=unsubscribe
> https://www.redhat.com/mailman/listinfo/redhat-list
>
--
----------------------------------
Best Regards
Waleed Harbi
Saudi Arabia
More information about the redhat-list
mailing list