Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有两个文件夹,其中包含数千个文档。A说 A和B 是目录。两者都B包含文件a.x b.x等等。内容当然不一样。所以我想附加以在其他文件夹a.x & a.x 中生成另一个。a.x此外,我需要从第二个文档中删除第一个令牌,例如:
A
B
a.x b.x
a.x & a.x
a.x
a.x in A:1 i go home a.x in B:1 he goes home
我想将新文档生成为:
1 i go home he goes home.
请给我一些脚本。
我会做:
mkdir OUTPUT cd A for f in * do join $f ../B/$f > ../OUTPUT/$f done
您可以通过for ... in循环来完成此操作,并且join(1):
for ... in
join(1)
mkdir c # for storing the results for file in $(ls a): do join "a/$file" "b/$file" >> "c/$file" done