![]() |
|
|
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 |
| Sticky Folders | mjdavies | UNIX for Dummies Questions & Answers | 1 | 10-16-2008 07:45 AM |
| compiled binary file gives "cannot execute binary file" | scgupta | SUN Solaris | 0 | 07-13-2006 02:59 AM |
| Copying Folders without some folders... ;-) | chimpu | UNIX for Dummies Questions & Answers | 5 | 04-26-2004 01:25 PM |
| Backing up Folders without some folders...;) | chimpu | Shell Programming and Scripting | 1 | 04-26-2004 11:02 AM |
| downloading folders in ftp | eloquent99 | UNIX for Dummies Questions & Answers | 6 | 04-23-2003 04:06 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
I am a beginner to all of this but undertand the basic principles. I am currently working on a large task and struggling with a the final part.
I have two files, folder 1 contains a list of around 20 files in binary (possibly treated as arrays?) folder 2 contains several files and sub folders each entry also in binary all i want to do is basically take each entry of folder 1 and see if there are any matching results in file 2, if there is any matches they should then be moved to a text folder 3 any solutions? |
|
||||
|
Quote:
Another possibility could be list files in folder 1 and check if they exists in folder 2. Then, use diff to compare. Something like: Code:
LIST=files.txt
ls folder1 > $LIST #list files from folder1
cat $LIST| while read line; do #for each filename
INPUT=$(echo ${line})
cd $folder2
if [ -f $INPUT ]; then #check if file exists and its a regular file
#files exists
diff $folder1/$INPUT $folder2/$INPUT > dev/nul 2>&1 #compares both
if [ "$?" == "0" ]; then #check for result.
#files exists and they're identical
fi
fi
done
I'm not sure if you searching for something like this. If so, check it, because it can contain some error: I'm also a newbie ![]() Albert. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|