Script behaving differently on two servers

All,

I have a script that runs on 2 servers and there seems to be something wrong. It's producing different results on the 2 servers.

Here is the script on server1 which is behaving correctly but on 2 behaving differently.

[quote]

2nd server:

I couldn't make out whats the error is? Please help

What is the result you expect and what is the o/p you get? What are the input files like? And what errors, if any, do you get? Its very difficult to make a guess. What Unix runs on both servers?

The script checks a file and then writes the data rows to the new file.

The file will be like this format

Header
Data
Conut of data rows

If the data rows equals the last row in the file which is Count of data rows
then the script writes the data rows to a new file with .new extension appended to the original file.

sample output in debug mode from the code2 which is having problem. The 1st code doesn't throw any error and it's working correctly.

The count in the file is correct but for some unkonwn reason it's showing error.

The code on 1 runs on HP-UX
and code on server 2 runs on SUNos

Use nawk on Sun OS. I am not sure though if that solves your problem..

Awesome!!!!!

Perfect. But why is this different behavior on different boxes?

You have different flavors of awk given by the HP & Sun. I havent worked on Sun OS but if you search this forum, there are similar issues encountered.