![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
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 |
| shell script to search content of file with timestamps in the directory | psychobeauty | Shell Programming and Scripting | 10 | 04-21-2008 05:37 AM |
| finding difference between 2 directory recursively | yayati | Shell Programming and Scripting | 2 | 04-09-2008 10:37 AM |
| content need changes- many files | swchee | Shell Programming and Scripting | 3 | 10-05-2006 12:29 PM |
| Can't view directory content - SUNOS | nhatch | UNIX for Advanced & Expert Users | 2 | 06-27-2006 03:23 AM |
| Use of unzip with content files > 2Gb | tcarlson | Filesystems, Disks and Memory | 2 | 09-17-2003 04:33 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
I want to record the difference in the content of files in different directory
Hi All
I am very new to the Unix shell scripting ,, could you pleae help me to generate the output file having the filename and path which files having the difference in the contents in the two directory. all files in both directory have the same name and format. input directory /edc/input1/ it also can have sub directory /edc/input2/ it also can have sub directory output file diffout having path and name fo file. please let me know if this requremnt are not clear please provide me some sample script. thanks Singh |
|
||||
|
If I understand correctly, try this
cd /edc/input1 ; find . -type f | sort > /tmp/input1.lst cd /edc/input2 ; find . -type f | sort > /tmp/input2.lst diff /tmp/input1.lst /tmp/input2.lst From the output, lines that begin with a less-than sign '<' exist only in /edc/input1 and those beginning with a greater-than sign '>' exist only in /etc/input2. To see which files exist in BOTH directories, use the join(1) command join /tmp/input1.lst /tmp/input2.lst |
|
||||
|
I want to record the difference in the content of files in different directorys
Hi hegemaro
diff /tmp/input1.lst /tmp/input2.lst is not giving any output. beacuse it is having the same file name in both of the list. i want to print the filename along wiht the path, which having diffrent contents, could u please giv me any idea how can we do this .. Singhal |
|
||||
|
Code:
ls /dir1 | while read x do str=$(diff /dir1/$x /dir2/$x ) [[ -n "$str" ]] && echo $x done |
| Sponsored Links | ||
|
|