- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: sdiff script help
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-22-2005 05:25 AM
12-22-2005 05:25 AM
I need to scripting help, I'm usless at scripting.
I'd like a script that comapres files in 1 directory with another directory.
Would it be possible to port such a script across different unix flavours?
Thanks.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-22-2005 05:28 AM
- Tags:
- dircmp
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-22-2005 05:30 AM
12-22-2005 05:30 AM
Re: sdiff script help
See the manpages for 'diff'. This will compare and report the differences for files or files within two directories.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-22-2005 05:36 AM
12-22-2005 05:36 AM
Re: sdiff script help
If you truly mean 'sdiff' have a look too at its manpages too. Both 'diff' and 'sdiff' are generalized to UNIX.
http://www.docs.hp.com/en/B2355-90689/diff.1.html
http://www.docs.hp.com/en/B2355-90690/sdiff.1.html
Regards!
...JRF...
- Tags:
- sdiff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-22-2005 05:58 AM
12-22-2005 05:58 AM
Re: sdiff script help
ls /dir1 >/tmp/f1
ls /dir2 >/tmp/f2
comm -23 ; # display names in /dir1 but not /dir2
comm -13 ; # display names in /dir2 but not /dir1
HTH
-- Rod Hills
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-22-2005 06:57 AM
12-22-2005 06:57 AM
Re: sdiff script help
Will this make a difference, dont have access to the servers right now to try out your suggestions?
thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-22-2005 09:32 PM
12-22-2005 09:32 PM
Re: sdiff script help
NAME
dircmp - directory comparison
SYNOPSIS
dircmp [-d] [-s] [-wn] dir1 dir2
DESCRIPTION
dircmp examines dir1 and dir2 and generates various tabulated
information about the contents of the directories. Sorted listings of
files that are unique to each directory are generated for all the
options. If no option is entered, a sorted list is output indicating
whether the filenames common to both directories have the same
contents.
-d Compare the contents of files with the same name in both
directories and output a list telling what must be
changed in the two files to bring them into agreement.
The list format is described in diff(1).
-s Suppress messages about identical files.
-wn Change the width of the output line to n characters. The
default width is 72.
HTH,
Art
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-23-2005 03:40 AM
12-23-2005 03:40 AM
Re: sdiff script help
#!/usr/bin/perl
@servers=qw/moe larry curly/;
foreach $server (@servers) {
open(INP,"ssh $server 'find /yourdir -print|'");
while(
chomp;
push(@{$hold{$_},$server);
}
close(INP);
}
foreach $dir (sort keys %hold) {
printf "%40s %s\n",$dir,join(",",@{$hold{$dir}});
}
This will list all the files and the servers they reside on. You could modify the script to only display those files that are not on all the servers.
HTH
-- Rod Hills
- Tags:
- Perl