我正在使用vimdiff. 在這種情況下,一個檔案有 11 行描述檔案的注釋,而另一個沒有注釋行。我很驚訝vimdiff(更確切地說,底層的 'diff' )沒有準確地分配要比較的行,所以每一行都是不同的。在這種情況下,應將第一個檔案的第 12 行與第二個檔案的第 1 行進行比較。
問題:有沒有辦法在不修改檔案的情況下調整哪些行vimdiff(或底層diff)比較(例如,向下移動 12)?
非常感謝您的幫助。
以下是檔案中的初始行:
檔案 1(包括評論)
# This table shows the intersection of dark by MAPQ regions by a gene annotation gff3, showing where dark by MAPQ regions fall within gene body
# chrom : Chromosome of dark by MAPQ region
# region_start : start position of dark by MAPQ region within gene-body element
# region_end : end position of dark by MAPQ region within gene-body element
# gene_body_id : ID of gene body element that contains this dark by MAPQ region
# region_type : genebody element type (e.g. exon, intron, UTR, etc.)
# biotype : GENCODE biotype of gene that contains this dark by MAPQ reigon
# gene_body_chrom : Chromosome of the genebody element
# gene_body_start : start position of the genebody element
# gene_body_end : end position of the genebody element
#chrom start end gene_body_id region_type biotype gene_body_chrom gene_body_start gene_body_end
1 11869 12227 DDX11L1_1 exon transcribed_unprocessed_pseudogene 1 11869 12227
1 12228 12611 DDX11L1_intron_1 intron transcribed_unprocessed_pseudogene 1 12228 12611
1 12612 12721 DDX11L1_2 exon transcribed_unprocessed_pseudogene 1 12612 12721
1 12722 12751 DDX11L1_intron_2 intron transcribed_unprocessed_pseudogene 1 12722 12973
1 12861 12973 DDX11L1_intron_2 intron transcribed_unprocessed_pseudogene 1 12722 12973
1 13191 13219 DDX11L1_intron_3 intron transcribed_unprocessed_pseudogene 1 13053 13219
檔案 2(不包括評論)
chr1 11869 12227 DDX11L1_1 exon transcribed_unprocessed_pseudogene chr1 11869 12227
chr1 12228 12611 DDX11L1_intron_1 intron transcribed_unprocessed_pseudogene chr1 12228 12611
chr1 12612 12721 DDX11L1_2 exon transcribed_unprocessed_pseudogene chr1 12612 12721
chr1 12722 12752 DDX11L1_intron_2 intron transcribed_unprocessed_pseudogene chr1 12722 12973
chr1 12861 12973 DDX11L1_intron_2 intron transcribed_unprocessed_pseudogene chr1 12722 12973
chr1 13191 13219 DDX11L1_intron_3 intron transcribed_unprocessed_pseudogene chr1 13053 13219
VimDiff 結果

uj5u.com熱心網友回復:
我也有同樣的問題,所以我開發了https://github.com/rickhowe/spotdiff.vim。您必須指定行范圍,但可以部分比較 2 個檔案甚至單個檔案中的任何行。您還可以選擇可視區域和文本物件進行比較。
uj5u.com熱心網友回復:
對于這種情況,我想出了一個解決方案,tail但我會很感激我可以直接在vimdiff.
# Skip the first 12 lines from file_1
vimdiff <(tail -n 12 file_1) file_2
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/425677.html
