Can anyone please help me with this problem ????????
I have to solve this problem but I don't have any clue how to do it. I am also new to Linux and have spent hours on thinking on the problem but I am clueless.
Here is the assignment. Any help will be highly appreciated :
We have two set of files, let's say they are in directory a and directory b. Let's say the file names are a1 a2 a3 a4 ... and b1 b2 b3 b4. (I thought having the same name might be confusing, so maybe having different names is better. So, you will need to line up a1 with b1, a2 with b2 ... to create c1, c2 ... File contents are different but they need to have overlapping parts. They also have spaces in them (more than one char space).
What you'll need to do is to create a 3rd set of files in directory c where files from directory a and b are merged. You will need to compare each line from file1 of directory a with file1 of directory b and write it into file1 of directory c. Meanwhile, you'll need to merge the lines, eliminate the blanks which are more than a single char space, and eliminate the duplicates and sort this content from left to write in the output file. This should work for multiple lines and multiple files (so you need to automate this). Let's consider that each line is a fixed length--i.e. at most 80 char for input files and 160 for the output files.
For example:
file1 of a: file1 of b:
ffffff eee ccc r 12 ddd fff k ccc bbbb zzz nnn eeeee aaaaaaaaa 3
file1 of c:
12 3 aaaaaaaaa bbbb ccc ddd eee eeeee fff ffffff k nnn r zzz
|