Comparing list of files in parallel


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Comparing list of files in parallel
# 8  
Old 11-19-2015
I have never done this before but I think I can learn it, I think it has something to do with echo and if I can add both files to that part, I read something about arrays too but I am not sure that will apply here. If I take off line and add the file name instead will that change the outcome?
# 9  
Old 11-19-2015
Moderator's Comments:
Mod Comment Ameenah Palmer,
Please do not hijack threads that are discussing a different topic. And, homework must be posted in the Homework and Coursework Questions forum and must include a completely filled out homework and coursework questions template as described in Rules for Homework & Coursework Questions Forum.

Please open a new thread to discuss your homework assignment problems.
# 10  
Old 11-20-2015
hope below prototype can help you some

Code:
num_of_files=`ls leo| wc -l`
loop_size=$((${num_of_files}/2))
i=1
while [ $i -le $loop_size ];do
  let tmp=$i+$loop_size
  echo "comparing file_${i} with file_${tmp}"
  let i=$i+1
done

root@qas0009[23:08:25]:/tmp>ls leo
Code:
file_1  file_10  file_11  file_12  file_13  file_14  file_15  file_16  file_17  file_18  file_19  file_2  file_20  file_3  file_4  file_5  file_6  file_7  file_8  file_9

output
Code:
comparing file_1 with file_11
comparing file_2 with file_12
comparing file_3 with file_13
comparing file_4 with file_14
comparing file_5 with file_15
comparing file_6 with file_16
comparing file_7 with file_17
comparing file_8 with file_18
comparing file_9 with file_19
comparing file_10 with file_20

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Comparing two files and list the difference with common first line content of both files

I have two file as given below which shows the ACL permissions of each file. I need to compare the source file with target file and list down the difference as specified below in required output. Can someone help me on this ? Source File ************* # file: /local/test_1 # owner: own #... (4 Replies)
Discussion started by: sarathy_a35
4 Replies

2. Shell Programming and Scripting

Comparing two edge list

Hello, I have two network edgelists with first two columns as nodes and the last column pearson correlation coefficient (PCC). I want to remove the edges from net1 whose edges are common with net2 && (PCC)net2>=(PCC)net1 net1.txt A B 0.6 A C 0.7 B C 0.7 D C ... (1 Reply)
Discussion started by: Sanchari
1 Replies

3. Shell Programming and Scripting

Curl parallel download file list

Hello guys, first post sorry if I did some mess here =) Using Ubuntu 14.04lts 64bits server version. I have a list (url.list) with only URLs to download, one per line, that looks like this: http://domain.com/teste.php?a=2&b=3&name=1 http://domain.com/teste.php?a=2&b=3&name=2 ...... (6 Replies)
Discussion started by: tonispa
6 Replies

4. Shell Programming and Scripting

Comparing list of files

Hi All, I have a list of files and want to find the difference between each file if there is difference then i want the file name to be printed and log the duplicate files For example Size Filename 23 a1 23 a2 23 a3 45 a4 If i diff a1 and a2 and find... (3 Replies)
Discussion started by: wedng.bell
3 Replies

5. Shell Programming and Scripting

Need Help with Bash - comparing directory contents with list of files

Hey guys, need help with a script I'm trying to write. Basically I need to compare the contents of a folder called "profiles" with a list of files called "template". when the file matches the contents of the folder it needs to set a variable called "checked" to "1" Cookies to anyone... (4 Replies)
Discussion started by: Scriporium
4 Replies

6. Shell Programming and Scripting

Need to read two files in parallel

Following is the requirement In FileA I have the content as follows. 1,2,3 111,222,333 1000,2000,3000 In FileB I have the content as follows. 4,5,6 444,555,666 4000,5000,6000 I need to read FileA and FileB parallely and create the FileC as follows. 1,2,3,4,5,6... (1 Reply)
Discussion started by: kmanivan82
1 Replies

7. Shell Programming and Scripting

Comparing two files and list the differences

Hi * I have two text files which has the file size, timestamp and the file name. I need to compare these two files and get the differences in the output format. Can anyone help me out with this. * cat file1.txt *474742 Apr 18* 2010 sample.log *135098 Apr 18* 2010 Testfile 134282 Apr 18* 2010... (7 Replies)
Discussion started by: Sendhil.Kumaran
7 Replies

8. UNIX for Dummies Questions & Answers

Copy files in Parallel

Is there any out of box Command in Unix or is it possible through shell scripting to copy all the files in a directory in Parallel. Example. I am doing a COLD database backup. I have the data/dbx directory which has around 1000 data files. I was thinking is there a way to spawn the copy... (10 Replies)
Discussion started by: simonsimon
10 Replies

9. Shell Programming and Scripting

Comparing a distinct value in 1 list with another list

Hi all, I need to compare the contents of 2 directories where the file contents are similar and take out the filenames whose contents does not exist within the 2 directories. Directory1 1 2 3 4 Directory2 54 55 56 57 Does anyone has a script which can do this? At the end of... (6 Replies)
Discussion started by: manualvin
6 Replies

10. UNIX for Dummies Questions & Answers

Comparing data list...

I have a list of files that I want to compare to another list of files, how do I do that? The first list will be my known list and hard coded, for example: mylist="janfile.tar jarfile.jar jan.rpt.Z" etc. The second list will be found by doing an 'ls' piped to a file: ls > filelist.dat ... (4 Replies)
Discussion started by: giannicello
4 Replies
Login or Register to Ask a Question