Reputation: 7143
i have two folders containing some thousands of documents. Say A and B are directories.Both A
and B
contains files a.x b.x
and so on. There content are different of course. So i would like to append a.x & a.x
to generate another a.x
in some other folder. Moreover I need to remove fist token from second document like:
a.x in A:1 i go home
a.x in B:1 he goes home
I want to generate new document as:
1 i go home he goes home.
Please suggest me some scripts.
Upvotes: 0
Views: 87
Reputation: 39261
You can accomplish this with a for ... in
loop and join(1)
:
mkdir c # for storing the results
for file in $(ls a): do
join "a/$file" "b/$file" >> "c/$file"
done
Upvotes: 0
Reputation: 4384
I would do:
mkdir OUTPUT
cd A
for f in *
do
join $f ../B/$f > ../OUTPUT/$f
done
Upvotes: 1