![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| comparing the content of two directories | xyzt | UNIX for Dummies Questions & Answers | 2 | 04-29-2008 11:36 AM |
| Comparing directories via ftp | tekster757 | UNIX for Dummies Questions & Answers | 1 | 03-21-2008 07:48 AM |
| comparing 2 Solaris servers | melanie_pfefer | SUN Solaris | 9 | 03-11-2008 01:29 PM |
| moving directories to new directories on multiple servers | mackdaddy07 | Shell Programming and Scripting | 0 | 04-06-2007 12:30 PM |
| compare directories on two servers | MizzGail | Shell Programming and Scripting | 1 | 03-25-2003 01:41 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Comparing directories on different unix servers
Is it possible to use the diff command to compare two directories on different Unix (AIX) servers? We have two regions set up and we want to be able to compare if the scripts directory in both regions contain the same files? I want to figure out if its possible.. Have been messing around by dumping the listing of each dir into separate files and comparing them with diff.. But that doesn't work the way i need it to.. Is there any other command out there that could work? Thanks, Jaz EDIT** Can something like this work?? I've tried it from the command line but it gives the following error. ksh: syntax error: `(' unexpected Code:
diff <(ssh server_name 'cd directory_to_compare; find . -type f -exec {} \;| sort -k 2') <(ssh servername2 'cd directory_to_compare; find . -type f -exec {} \;| sort -k 2') >> diff_report.txt
Last edited by Jazmania; 10-29-2009 at 09:56 PM.. |
|
||||
|
don't understand your command, there is no command follow by -exec, if the missed command is ls, then you needn't -exec, use -print (or not, -print is default for find) will export the file list. Because there is no command for -exec, I don't understand what you sort for. Code:
diff <(ssh server_name 'find directory_to_compare -type f | sort') <(ssh server_name 'find directory_to_compare -type f | sort') |
|
||||
|
Ok, maybe I don't need the sort.. Just tried Code:
diff <(ssh paehowup2303 'find /home/x136873 -type f') <(ssh njros1up2303 'find /home/x136873 -type f') still getting ksh: syntax error: `(' unexpected I'm running this straight from command line at the minute.. do i need the ' in the command? |
|
||||
|
Korn shell..
---------- Post updated at 09:37 PM ---------- Previous update was at 04:45 AM ---------- Would it be possible to use the "rsync --dry-run" option to find differences in directories on separate servers.. Only just come across the command and not sure how it works.. The man pages are pretty long.. When comparing the directories can the command work over ssh? I'm can't get my head around how the command works... Last edited by Jazmania; 10-30-2009 at 05:44 PM.. |
|
||||
|
In Korn shell I would expect something more like this: - Code:
diff <$(ssh paehowup2303 'find /home/x136873 -type f') <$(ssh njros1up2303 'find /home/x136873 -type f') The $ gets rid of the unexpected ( error but I think it still wont work as the diff is expecting file names |
|
||||
|
No, the syntax is correct with the <(..) constructs. Jazzmania, my guess would be that you are running ksh88 on the system you are firing the command from. What happens if you run this: Code:
(echo ${.sh.version}) 2>&- || echo ksh88
Perhaps /bin/ksh93 is present on your system too. If so try start up that shell and try running the command from there. No, you can leave them out. Last edited by Scrutinizer; 10-31-2009 at 07:28 PM.. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|