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.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
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
2. HP-UX
want to remove the thread
thanks (2 Replies)
Discussion started by: indira
2 Replies
3. Shell Programming and Scripting
want to remove this thread.
thanks (2 Replies)
Discussion started by: indira
2 Replies
4. UNIX for Dummies Questions & Answers
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
5. UNIX for Advanced & Expert Users
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
6. Shell Programming and Scripting
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
7. Shell Programming and Scripting
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
8. Shell Programming and Scripting
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
9. Solaris
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
10. Shell Programming and Scripting
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
XZDIFF(1) XZ Utils XZDIFF(1)
NAME
xzcmp, xzdiff, lzcmp, lzdiff - compare compressed files
SYNOPSIS
xzcmp [cmp_options] file1 [file2]
xzdiff [diff_options] file1 [file2]
lzcmp [cmp_options] file1 [file2]
lzdiff [diff_options] file1 [file2]
DESCRIPTION
xzcmp and xdiff invoke cmp(1) or diff(1) on files compressed with xz(1), lzma(1), gzip(1), or bzip2(1). All options specified are passed
directly to cmp or diff. If only one file is specified, then the files compared are file1 (which must have a suffix of a supported com-
pression format) and file1 from which the compression format suffix has been stripped. If two files are specified, then they are uncom-
pressed if necessary and fed to cmp(1) or diff(1). The exit status from cmp or diff is preserved.
The names lzcmp and lzdiff are provided for backward compatibility with LZMA Utils.
SEE ALSO
cmp(1), diff(1), xz(1), gzip(1), bzip2(1), zdiff(1)
BUGS
Messages from the cmp(1) or diff(1) programs refer to temporary filenames instead of those specified.
Tukaani 2009-07-05 XZDIFF(1)