The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



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
report generation gmahesh2k UNIX for Dummies Questions & Answers 2 05-16-2008 01:41 AM
awk- report generation from input file McLan Shell Programming and Scripting 6 03-17-2008 05:34 AM
2nd Generation SOA = EDA + CEP? iBot Complex Event Processing RSS News 0 11-28-2007 08:30 PM
Shellcode Generation using C Legend986 High Level Programming 2 10-08-2007 01:25 AM
Oracle Report generation DILEEP410 Shell Programming and Scripting 7 01-04-2007 04:52 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 05-15-2008
gmahesh2k gmahesh2k is offline
Registered User
  
 

Join Date: May 2008
Posts: 8
Red face Report generation

Hello,
I got a requirement in writing a KSH script in unix, please help me out

the requirement is there are two folders Folder1 and Folder2 and there are same files in the different folders. like file1,file2 in folder1 and file1 and file2 in folder2.

I would like to compare all the similar files in the two folders and generate a report where this report should have filename and Matched(Y/N)

If the files are similar then Y else N.

Thanks in advance

Mahesh
  #2 (permalink)  
Old 05-15-2008
Annihilannic Annihilannic is offline Forum Advisor  
  
 

Join Date: May 2008
Location: Sydney, Australia
Posts: 1,009
What have you tried so far? Are you aware of the diff and comm commands? Have a read of their man pages.
  #3 (permalink)  
Old 05-15-2008
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,715
try soemthing like this
Code:
for file in /folder1/* 
do
     file2="/folder2/`basename $file`"
     if [[ -r $file2 ]] ; then
         cksum $file | read one dummy1 dummy2
         cksum  $file2 read two dummy1 dummy2
         echo "$file   $file2 \c"
         if [[ "$one" = "$two" ]] ; then
                 echo "Y"
         else
                 echo "N"
         fi
     fi
done
  #4 (permalink)  
Old 05-16-2008
gmahesh2k gmahesh2k is offline
Registered User
  
 

Join Date: May 2008
Posts: 8
Smile report generation

Thanks you jim
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 10:08 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0