The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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 and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
converting midi to wav in solaris 10 conandor SUN Solaris 1 11-22-2008 07:52 AM
FTP on Reliant UNIX - script problem amon Shell Programming and Scripting 0 06-26-2006 06:41 AM
Reliant Unix and Disk Mirrors gull04 UNIX for Advanced & Expert Users 0 12-17-2004 04:56 AM
Disk Mirrors in Reliant Unix - Problem? gull04 Filesystems, Disks and Memory 0 12-16-2004 07:07 AM
Problems with migration from Reliant Unix to Solaris MS-No SUN Solaris 2 08-27-2004 07:21 AM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 01-05-2009
abdulaziz abdulaziz is offline
Registered User
  
 

Join Date: Dec 2007
Posts: 15
converting from reliant 2 solaris

Hello...

I am trying to convert my script from one to another unix flavor...
from reliant to solaris...I did all but can not convert this awk/nawk:
First code if code that works what I want under reliant and the second should do same under solaris but it does not


I did so far from this :

Code:
awk  -vx=$deldate90 -vy=$deldate60 -vz=$unixdate ' 
        {ins = $4 $5 $6 
         expdate = $4 $5 $6 
                { if ( ins != "20010101" ) 
                     { if ( expdate < z ) 
                          {if ( expdate < x )
                              print $1","$2","$3"," $5"."$6"."$4",O"  > ("St"); 
                           if ( expdate >= x )
                              { if (expdate < y)
                                   print $1","$2","$3"," $5"."$6"."$4",D" > ("De")
                                if ( expdate >= y )  
                                   print $1","$2","$3"," $5"."$6"."$4",N" > ("In")}}
                       if ( expdate >= z && $4 != 2030) 
                           print $1","$2","$3"," $5"."$6"."$4",A" > ("Ak")}}} ' myfile

to this:

Code:
nawk -v x=$deldate90 -v w=$deldate60 -v z=$unixdate ' 
{

                expdate = $4 $5 $6
                
                if (expdate < z)
                {
                        
                        if (expdate < x)
                        {
                                print $1","$2","$3"," $5"."$6"."$4",O"  > ("/path/to/some/St")
                        }
                        else if (expdate >= x)
                        {
                                        if (expdate < w)
                                                {
                                                        print $1","$2","$3"," $5"."$6"."$4",D" > ("/path/to/some/De")
                                                }
                                        else
                                                {
                                                        print $1","$2","$3"," $5"."$6"."$4",N" > ("/path/to/some/In")
                                                }
                        }
                
                
                }
                                        
                else if (expdate >= z && $4 != 2030)
                {
                                                        print $1","$2","$3"," $5"."$6"."$4",A" > ("/path/to/some/Ak")
                }


}' myfile

but this new code does not do same thing like first one...
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 01:53 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0