Find match in two diff file - local srv and remote server


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Find match in two diff file - local srv and remote server
# 1  
Old 03-07-2008
Find match in two diff file - local srv and remote server

Perl Guru....

I need to compare two diff file (file1.abc will locate in current server and file2.abc will locate in remote server), basically the script will look for match in both file and only will send out email if there is no match and also give me list of unmatch and dups as well.

So here is the logic how the script will work.

The script will reside in Server1.
Server 1 has 13 different files like:

file1.abc ..............>compare with remote server (server 2) file2.abc
file1.bcd..............>compare with remote server (server 3) file2.abc
file1.dfg ..............>compare with remote server (server 4) file2.abc
file1.ghi..............>compare with remote server (server 5) file2.abc
file1.ijk..............>compare with remote server (server 6) file2.abc
file1.klm..............>compare with remote server (server 7) file2.abc
file1.mno..............>compare with remote server (server 8) file2.abc
file1.opq..............>compare with remote server (server 9) file2.abc
file1.qrs..............>compare with remote server (server 10) file2.abc
file1.stu..............>compare with remote server (server 11) file2.abc
file1.uvw ..............>compare with remote server (server 12) file2.abc
file1.wxy..............>compare with remote server (server 13) file2.abc
file1.yza..............>compare with remote server (server 14) file2.abc

(The file names before extension are the same in Server1, but all filename are same in remote servers)

Now I need to compare file1.abc with remote server (Server 2) filename (file2.abc) (/xxx/xyx/mns/file2.abc). The script need to compare only with component name
In this example sunsoloaris, hpunix, linux.


All of the file has same format in both file types.
Format is like the following:

file1.abc format:

Fsdfsdf kkldfsd
Component sunsolaris
Sdfsdfs dfdsfds
Sdfsdf sdfsdf
Sdfsdf ertyertre
Sdfsdf hfdghdfgd

Fsdfsdf kkldfsd
Component hpunix
Sdfsdfs dfdsfds
Sdfsdf sdfsdf
Sdfsdf ertyertre
Sdfsdf hfdghdfgd



Fsdfsdf kkldfsd
Component linux
Sdfsdfs dfdsfds
Sdfsdf sdfsdf
Sdfsdf ertyertre
Sdfsdf hfdghdfgd


Following is file2.abc (Remote server - server 2)

Fsdfsdf kkldfsd
Component sunsolaris
Sdfsdfs dfdsfds
Sdfsdf sdfsdf
Sdfsdf ertyertre
Sdfsdf hfdghdfgd

Fsdfsdf kkldfsd
Component winxp
Sdfsdfs dfdsfds
Sdfsdf sdfsdf
Sdfsdf ertyertre
Sdfsdf hfdghdfgd

Fsdfsdf kkldfsd
Component hpunix
Sdfsdfs dfdsfds
Sdfsdf sdfsdf
Sdfsdf ertyertre
Sdfsdf hfdghdfgd

Fsdfsdf kkldfsd
Component winxp
Sdfsdfs dfdsfds
Sdfsdf sdfsdf
Sdfsdf ertyertre
Sdfsdf hfdghdfgd




Output will be in an email:
(If exact match of Component found don't send email.)
If exact match of Component not found send email. E-mail should indicate:
Component linux not found in file2.abc in remote server (server 2)
Multiple entries of Component winxp found in file2.abc in remote server (server 2)

To get date from remote server login and passwd will be required.


Thanks.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to Append the output of a script running in remote server to a file in local server?

Hi guys, So i am in server1 and i have to login to server 2, 3,4 and run some script there(logging script) and output its result. What i am doing is running the script in server2 and outputting it to a file in server 2 and then Scp'ing the file to server1. Similarly i am doing this for other... (5 Replies)
Discussion started by: srkmish
5 Replies

2. Solaris

Script to get files from remote server to local server through sftp without prompting for password

Hi, I am trying to automate the process of fetching files from remote server to local server through sftp. I have the username and password for the remote solaris server. But I need to give password manually everytime i run the script. Can anyone help me in automating the script such that it... (3 Replies)
Discussion started by: ssk250
3 Replies

3. Shell Programming and Scripting

How to create a file in remote server from local server?

hi, can anyone tell me how can i store the names of a file that are in remote server to a file and then get the file that contains the name in local server? there is a remote server where 5 files are present , say a.txt b.txt c.txt d.txt e.txt i want to write a script in my local... (4 Replies)
Discussion started by: Little
4 Replies

4. Shell Programming and Scripting

preserving the timestamp of a file when copied from remote server to local server using ftp

Hi, I need to copy few files from remote server to local server. I write a shell script to connect to the remote server using ftp and go to that path. Now i need to copy those files in the remote directory to my local server with the timestamp of all those files shouldnt be changed. ... (5 Replies)
Discussion started by: arunkumarmc
5 Replies

5. Shell Programming and Scripting

Can a script runned in local server access remote server?

Hi, Im creating a script that is supposed to run commands on remote server using sftp. My script is as below: #!/bin/ksh sftp remote_server mypassword cd /u08/mydir/allfiles mget * .. But this is what I got when I runned the script: Connecting to remote server...... (3 Replies)
Discussion started by: luna_soleil
3 Replies

6. UNIX for Advanced & Expert Users

Commands to copy a tar.gz file from a Remote Unix Server to Local Desktop.

Hi, Just wanted to know, how can I ftp/transfer/copy a (design.tar.gz) archive from a Unix Server (sdmc222.sdmc.cp-srv.com) which is at a remote location, to my Windows Desktop. Obviously, it is not possible at cmd prompt on my Windows using the following commands :- ftp... (3 Replies)
Discussion started by: marconi
3 Replies

7. UNIX for Dummies Questions & Answers

how to find whether a file is local or remote file?

Is there any system call to find whether a file is local or remote?? Thanks in advance!! -Jack Fds (3 Replies)
Discussion started by: jackfds
3 Replies

8. Shell Programming and Scripting

Transfer file from local unix server to remote server

want to remove this thread. thanks (2 Replies)
Discussion started by: indira
2 Replies

9. HP-UX

Transfer file from local unix server to remote server

want to remove the thread thanks (2 Replies)
Discussion started by: indira
2 Replies

10. Shell Programming and Scripting

FTP multiple files from remote server to local server

Hi, I am facing a weired problem in my FTP script. I want to transfer multiple files from remote server to local server everyday, using mget * in my script. I also, want to send an email for successful or failed FTP. My script works for file transfer, but it don't send any mail. There is... (2 Replies)
Discussion started by: berlin_germany
2 Replies
Login or Register to Ask a Question