garyrickert 0 Newbie Poster

I have a bunch of scripts that get data from a number of systems to analyze / report against. Up to now I have been taking the output to the screen and just copy/pasting into a file. I am now trying to send directly to files, but when I try to process against these it fails. When I diff the copy/paste file and the direct, all lines are different, yet they appear identical. The following is an example that demonstrates the problem.

1st, the client side is CentOS release 5.2 (Final)
The server sides are CentOS 5.2, 5.4 and 5.5 and the results are the same from all.

I am putty'd into the client.

An example of a script, /home/SERVICES:

#!/bin/sh
/sbin/service httpd status
/sbin/service postfix status
/sbin/service memcached status
/sbin/service mysqld status

Which is run from DEV(client):

#!/bin/sh
ssh -t SERVER1 'sudo /home/SERVICES' > SERV.out

or

#!/bin/sh
ssh -t SERVER1 'sudo /home/SERVICES'

which sends the output to the screen which is then copied and pasted to SERV2.out

P-F-A root / #diff SERV.out SERV2.out
1,4c1,4
< httpd (pid 3239) is running...
< master (pid 3040) is running...
< memcached (pid 29436) is running...
< mysqld (pid 2964) is running...
---
> httpd (pid 3239) is running...
> master (pid 3040) is running...
> memcached (pid 29436) is running...
> mysqld (pid 2964) is running...

I have tried many things to identify the differences. When I run a sed script to replace the EOF to an X, the X replaces the first char of each line in the 'direct to file' script, which may be a good clue, but leaves me clueless to address. Hope one of you can assist.

P-F-A root / #cat SERV.out | sed -e "s/$/X/"
httpd (pid 3239) is running...X
master (pid 3040) is running...X
memcached (pid 29436) is running...X
mysqld (pid 2964) is running...X

P-F-A root / #cat SERV2.out | sed -e "s/$/X/"
Xttpd (pid 3239) is running...
Xaster (pid 3040) is running...
Xemcached (pid 29436) is running...
Xysqld (pid 2964) is running...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.