HP UX and AIX compatibility issue


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting HP UX and AIX compatibility issue
# 1  
Old 11-27-2009
HP UX and AIX compatibility issue

Hi All,
The below code works perfectly on AIX machine but doesnt give the desired o/p on HP UX.
Can someone please generalise the code so that it becomes platform independent.

Code:
awk 'NR == FNR {
  /^[ \t]*\47name/ && c++      # get the field number
  if (/^[ \t]*\47size/) {
    split($0, t, ":")          
    gsub(/[ \t\47,]/, x, t[2]) # strip punctuation
    fmt[c] = t[2]              # get the size 
    }
  next                         # run the above actions                                     
  }                            # + only for the first input file
{ 
  for (i=1; i<=NF; i++)        # output the strings in the correct format
    printf "%" (length($i) > fmt[i] ? "." : "-" ) fmt[i] "s", $i           
  print x
  }' config.txt temp.txt

# 2  
Old 11-27-2009
I should imagine a look at config.txt and temp.txt would raise your chances of getting a sensible reply considerably. Not to mention a glimps of the output on both platforms??

In the mean time have you tried using nawk?
# 3  
Old 11-28-2009
The input temp.txt
Code:
1       12      123     1234    1
A       AB      ABC     ABDC    e

config.txt

{
                        'name'  :       'Field1',
                        'type'  :       'input',
                        'spos'  :       1,
                        'size'  :       2,
                },
                {
                        'name'  :       'Field2',
                        'type'  :       'input',
                        'spos'  :       3,
                        'size'  :       2,
                },
                {
                        'name'  :       'Field3',
                        'type'  :       'input',
                        'spos'  :       5,
                        'size'  :       8,
                },
                {
                        'name'  :       'Field4',
                        'type'  :       'input',
                        'spos'  :       13,
                        'size'  :       11,
                },
                {
                        'name'  :       'Field5',
                        'type'  :       'input',
                        'spos'  :       24,
                        'size'  :       11,
                },


OUTPUT in HP-AX is as follows 
1 12123     12341
A ABABC     ABDCe

Expected is 
1 12123     1234       1
A ABABC     ABDC       e

the output comes as expected in AIX. and nawk isnt recognised in HP unix
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. AIX

Ksh93/AIX compatibility

Hi everyone ! Im trying to know from wich version of AIX KSH93 is available ? Internet tell me 6.x and 7.x AIX are available, bue what about 5.x ? Is KSH93 available on AIX 5.x ? Is it the same way to manipulate variables as KSH93 on 7.x ? Thanks for your support and have a nice day ! (2 Replies)
Discussion started by: majinfrede
2 Replies

2. Shell Programming and Scripting

Backward compatibility issue with GNU bash, version 4.3.42(5)

Hi, I have made a snake game on below bash version. But it is not backward compatible. Can someone suggest a version which is most commonly used and is backward compatible so that i can change my code and share again? I have attached the game script. If someone can run it please also suggest... (5 Replies)
Discussion started by: amit14august
5 Replies

3. Shell Programming and Scripting

Compatibility issues between Sun solaries & AIX commands.

Hi, I am migrating few of the shell scripts from existing SUN Solaries to AIX. My script contains some command like 'dos2unix' and 'unix2dos' which are not compatible in AIX flavour. Please let me know if there is any such commands in AIX which can replace these commands. Thanks. (1 Reply)
Discussion started by: 46019
1 Replies

4. AIX

AIX memory issue

Currently server have load while there is no heavy things running, just oracle database/ application server oracle. I don't understand why server have heavy load, 22GB is under buffer, how to clean buffer/memory in AIX load averages: 9.42, 9.43, 9.68; 05:25:08 141 processes: 125 idle, 16... (12 Replies)
Discussion started by: learnbash
12 Replies

5. Solaris

IPv6 compatibility issue .

Dear All, Need your advise. Can the Sun Fire V240 or Sun Fire V440 support with IPv6? Or it was depend to the OS? Any supporting document i can refer? Thank for help (0 Replies)
Discussion started by: pcw
0 Replies

6. AIX

AIX performance issue

Hi Guys, This is the situation I am in. Provide your views and input where should I start? I have one P7 test server and a p520 production server. the job is taking pretty long on the P7 test server when compared to the P5 production server. below is the full detail. Informix... (5 Replies)
Discussion started by: ithinksgreen
5 Replies

7. AIX

apache/tomcat compatibility with AIX versions

Hello, Where can i find the information about the compatibility versions of tomcat with AIX? for example, AIX 5.2 supported tomcat versions?? (1 Reply)
Discussion started by: balareddy
1 Replies

8. UNIX for Advanced & Expert Users

Aix pid issue

Hi I have an IBM AIX 5.3 64Bit running with 64bit application (Kernel runs on 64bit also). I changed the maximum proccesses per user to the maximum. Currently the pids of proccesses in the system using 5 digits (<100000). Is it possible to make the system use pids bigger then 4500000? I need it... (6 Replies)
Discussion started by: idana
6 Replies

9. AIX

Upgrading AIX 5.2 to AIX 6.1 - GCC compatibility

Hi All, We are in the processing of upgrading our AIX server OS from 5.2.0.0 to 6.1. And we have a set of highly critical running C applications in AIX box. I have a question like whether this upgradation of OS will affect any C code compilation and C runtime enviornment... how does AIX 6.1... (1 Reply)
Discussion started by: karthikc
1 Replies

10. AIX

Issue "Error 404" when upgrade AIX 5300-05-CSP-0000 to AIX (5300-09-02-0849)

Please read my issue! My old server using: - AIX system operating (5300-05-CSP-0000) - WebSphere 6.1.0.21 (Fix Pack 21) After I've upgraded version AIX - AIX system operating (5300-09-02-0849) - WebSphere 6.1.0.21 (Fix Pack 21) I have 1 issue when I access home page: "Error... (0 Replies)
Discussion started by: gamonhon
0 Replies
Login or Register to Ask a Question