我有一个包含许多此类行的文件,其中包含一些文件的路径。
../../ds1_src/wrapper/memory/beh/mem_1w1r_8x160.v
../../ds1_src/wrapper/memory/beh/mem_1w1r_8x134.v
../../ds1_src/wrapper/memory/beh/mem_1w1r_8x178.v
../../ds1_src/wrapper/memory/beh/mem_1w1r_20x68.v
../../ds1_src/wrapper/memory/beh/mem_1w1r_280x128.v
../../ds2_src/wrapper/memory/beh/mem_1w1r_8x160.v
../../ds2_src/wrapper/memory/beh/mem_1w1r_8x134.v
../../ds2_src/wrapper/memory/beh/mem_1w1r_64x7.v
../../ds2_src/wrapper/memory/beh/mem_1w1r_24x128.v
../../ds2_src/wrapper/memory/beh/mem_1w1r_8x178.v
../../ds2_src/wrapper/memory/beh/mem_1w1r_20x68.v
../../ds2_src/wrapper/memory/beh/mem_1w1r_280x128.v
../../ds3_src/wrapper/memory/beh/mem_1w1r_1x160.v
../../ds3_src/wrapper/memory/beh/mem_1w1r_1x128.v
../../us_src/wrapper/memory/beh/mem_1w1r_128x8.v
../../us_src/wrapper/memory/beh/mem_1w1r_8x160.v
../../us_src/wrapper/memory/beh/mem_1w1r_8x178.v
../../us_src/wrapper/memory/beh/mem_1w1r_20x68.v
../../us_src/wrapper/memory/beh/mem_1w1r_280x128.v
../../src/sw/mem_1w1r_8x31.v
../../src/sw/mem_1w1r_8x35.v
其中一些是重复文件。
我希望对它进行排序和统一,以便删除重复的文件行。
% grep -r "mem_1w" rtl_list | awk '{split($$0,a,"/"); print a[7]}' | sort -u
我可以做类似上面的事情来统一文件名 - 但这会导致行的第一部分../../ds1_src/....
等被砍掉。此外,在 a[5] 和../../src/sw/mem_1w1r_8x31.v
.
mem_1w1r_128x8.v
mem_1w1r_145x133.v
mem_1w1r_1x128.v
mem_1w1r_1x160.v
mem_1w1r_20x68.v
mem_1w1r_24x128.v
mem_1w1r_280x128.v
mem_1w1r_64x7.v
mem_1w1r_73x133.v
mem_1w1r_8x134.v
mem_1w1r_8x160.v
mem_1w1r_8x178.v
我怎样才能解决这个问题 - 得到类似的东西 -
../../ds1_src/wrapper/memory/beh/mem_1w1r_8x160.v
../../ds1_src/wrapper/memory/beh/mem_1w1r_8x134.v
../../ds1_src/wrapper/memory/beh/mem_1w1r_64x7.v
../../ds1_src/wrapper/memory/beh/mem_1w1r_1x160.v
../../ds1_src/wrapper/memory/beh/mem_1w1r_1x128.v
这将删除存在于不同位置的任何重复文件?